Skip to content

Conversation

@Zilula
Copy link

@Zilula Zilula commented Aug 22, 2025

Added optional RequestOptions parameter to the callTool function in the useMCP hook, allowing users to pass request-specific options like timeout values when calling MCP tools.

Motivation and Context

Users needed the ability to customize request behavior (such as timeout values) when calling MCP tools through the useMCP hook. Previously, all tool calls used default request settings with no way to override them for specific use cases
that might require longer timeouts or other request-level configurations.

How Has This Been Tested?

  • Tested basic tool calls without options (backward compatibility)
  • Tested tool calls with timeout options
  • Verified TypeScript type checking works correctly
  • Confirmed the options are properly passed to the underlying MCP client

Breaking Changes

None. This is a fully backward-compatible change. The options parameter is optional, so existing code will continue to work without modifications.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

  • Created a new RequestOptions type in src/react/types.ts with proper TypeScript definitions
  • Updated the UseMcpResult.callTool type signature to include the optional options parameter
  • Modified the implementation in useMcp.ts to accept and forward the options to the underlying MCP client request
  • Added JSDoc documentation for the new parameter
  • The RequestOptions type is designed to be extensible for future request-level options beyond just timeout

@Zilula Zilula changed the title [WIP] Add optional parameter for callTool options including timeout. Add optional parameter for callTool options including timeout. Aug 22, 2025
@Zilula
Copy link
Author

Zilula commented Sep 22, 2025

@geelen bump. Pretty useful piece of utility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant