Skip to content

Add optional parameter for callTool options including timeout. #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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
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