Skip to content

fix: remove unnecessary fields from tools' inputSchema#856

Open
fpoli wants to merge 1 commit into
modelcontextprotocol:mainfrom
fpoli:fpoli/issue-847
Open

fix: remove unnecessary fields from tools' inputSchema#856
fpoli wants to merge 1 commit into
modelcontextprotocol:mainfrom
fpoli:fpoli/issue-847

Conversation

@fpoli
Copy link
Copy Markdown

@fpoli fpoli commented May 19, 2026

This PR cleans up the inputSchema generation of MCP tools, removing the unnecessary top-level fields mentioned in #847.

In more detail, the PR adds a schema_for_input wrapper around schema_for_type. The wrapper prepares the inputSchema of macro-generated tool descriptions, removing the top-level title and description fields (i.e. the type name and doc of T in Parameters<T>).

Motivation and Context

See #847. To sum up, I think the top-level title and description fields are unnecessary:

  1. They are not useful. They describe a wrapper type (the T in Parameters<T>) that should not be leaked to the LLM. See these examples. What matters is the type and docs of the fields of T, which remain in the inputSchema and are not modified by this PR.
  2. The fields are not required by the MCP specification (schema). They add noise that can reach the model and consume context tokens.

How Has This Been Tested?

By adding a test_list_tools_result.rs, which compares the tool description against a reference description in a JSON file.

(No) Breaking Changes

The top-level title and description disappear from the inputSchema. This is not a breaking change because the fields are not part of the MCP specification.

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

Fixes #847.

@fpoli fpoli requested a review from a team as a code owner May 19, 2026 13:05
@github-actions github-actions Bot added T-test Testing related changes T-config Configuration file changes T-core Core library changes T-handler Handler implementation changes T-macros Macro changes T-model Model/data structure changes labels May 19, 2026
@fpoli fpoli force-pushed the fpoli/issue-847 branch from 23b40f9 to 6120a7d Compare May 19, 2026 13:34
@github-actions github-actions Bot added the T-documentation Documentation improvements label May 19, 2026
@fpoli fpoli force-pushed the fpoli/issue-847 branch from 6bb4927 to c23accd Compare May 19, 2026 13:37
@fpoli fpoli force-pushed the fpoli/issue-847 branch from c23accd to c0cfbaa Compare May 19, 2026 14:40
@fpoli fpoli changed the title fix: Remove unnecessary fields from tools' inputSchema fix: remove unnecessary fields from tools' inputSchema May 19, 2026
Copy link
Copy Markdown
Contributor

@jamadeo jamadeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me

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

Labels

T-config Configuration file changes T-core Core library changes T-documentation Documentation improvements T-handler Handler implementation changes T-macros Macro changes T-model Model/data structure changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool listing returns unnecessary fields

3 participants