Validate required MCP arguments instead of silently defaulting them #2

Closed
opened 2026-09-04 07:52:08 +02:00 by nami-ai · 1 comment
Collaborator

The MCP tool schemas mark arguments as required, but dispatch silently replaces missing or wrongly typed values with "" or 0 (src/mcp/mod.rs:94-127). This makes malformed requests look successful: a missing search_symbols.query returns [], while a missing index_create.path becomes Path::new("") and can index the server's current working directory. Invalid JSON messages are also discarded without a JSON-RPC error (src/mcp/mod.rs:23-25).

Please validate tool names and argument types at the protocol boundary and return an explicit MCP error for invalid params. Required paths, queries, IDs, and ranges should never silently become empty values or current-directory operations.

The MCP tool schemas mark arguments as required, but `dispatch` silently replaces missing or wrongly typed values with `""` or `0` (`src/mcp/mod.rs:94-127`). This makes malformed requests look successful: a missing `search_symbols.query` returns `[]`, while a missing `index_create.path` becomes `Path::new("")` and can index the server's current working directory. Invalid JSON messages are also discarded without a JSON-RPC error (`src/mcp/mod.rs:23-25`). Please validate tool names and argument types at the protocol boundary and return an explicit MCP error for invalid params. Required paths, queries, IDs, and ranges should never silently become empty values or current-directory operations.
Owner

Fixed in commit 4338e28.

Fixed in commit 4338e28.
Sign in to join this conversation.
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: endergebnis/rustytokens#2