Skip to content

Conversation

@pusewicz
Copy link
Contributor

When defining a tool without any arguments taken, it should be allowed to not have to define the input_schema at all, and the default value for such a scenario should be { type: "object" } as per the schema.

https://github.com/modelcontextprotocol/modelcontextprotocol/blob/16d91abb68bbc824944c5bda4ac2e2ccaaa74b0f/schema/2025-06-18/schema.ts#L896-L900

Motivation and Context

When testing a tool without the input_schema defined, the mcp-inspector returns an error when trying to list the tool:

Error
[ { "code": "invalid_type", "expected": "object", "received": "undefined", "path": [ "tools", 1, "inputSchema" ], "message": "Required" } ]

How Has This Been Tested?

Added new tests and locally using the mcp-inspector.

Breaking Changes

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

@pusewicz pusewicz force-pushed the default-input-schema branch from b4b715f to 8c4f0ae Compare July 30, 2025 16:37
@koic
Copy link
Member

koic commented Jul 31, 2025

The linter appears to be failing in CI. It can be checked locally by running bundle exec rake.

@koic
Copy link
Member

koic commented Jul 31, 2025

CI passed. Can you squash your commits into one?

When defining a tool without any arguments taken, it should be allowed
to not have to define the `input_schema` at all, and the default value
for such a scenario should be `{ type: "object" }` as per the schema.

https://github.com/modelcontextprotocol/modelcontextprotocol/blob/16d91abb68bbc824944c5bda4ac2e2ccaaa74b0f/schema/2025-06-18/schema.ts#L896-L900
@pusewicz pusewicz force-pushed the default-input-schema branch from 0812ac7 to 2508def Compare July 31, 2025 06:36
@pusewicz
Copy link
Contributor Author

@koic Done!

@koic koic merged commit 2c3f218 into modelcontextprotocol:main Jul 31, 2025
5 checks passed
@koic
Copy link
Member

koic commented Jul 31, 2025

Thanks!

@pusewicz pusewicz deleted the default-input-schema branch July 31, 2025 16:51
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.

2 participants