Free-text MCP tool parameters should set maxLength
Free-text inputs like query or message with no maxLength accept any size. Add a maxLength so clients and the server share the limit. Info-level.
Add maxLength to free-text string parameters such as query or message. The rule schema.free-text-unbounded is an info-level, warn-status finding for general clients and Claude.
What you see
- A scan reports
schema.free-text-unbounded:No maxLength on: query. - It checks string parameters whose names match q, query, text, prompt, content, body, message, input, description, note, comment, search, keywords, sql, code, question. Parameters with an enum, pattern or format are skipped.
Why it happens
Schema generators emit { "type": "string" } and nobody adds a cap. The rule's fix text says the spec requires servers to validate inputs and that bounded schemas also tell clients the limits.
Check it yourself
curl -s -X POST https://mcp.acme.example/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Authorization: Bearer $TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
| jq -r '.result.tools[] | . as $t | (.inputSchema.properties // {}) | to_entries[] | select(.key | test("^(q|query|text|prompt|content|body|message|input|description|note|comment|search|keywords?|sql|code|question)$"; "i")) | select(.value.type == "string" and (.value.maxLength | not)) | "\($t.name).\(.key)"'
Fix
"query": { "type": "string", "maxLength": 500, "description": "Search text, for example an order number or customer name." }
Enforce the same limit in the handler.
Verify
The command prints nothing, then re-scan.
Which clients care
General and Claude, per the rule.
Source
MCP tools spec: https://modelcontextprotocol.io/specification/2026-07-28/server/tools
Run a free scan at https://mcpshipyard.com/scan to check every rule at once.
Check every rule at once
A free scan runs this check and the other 152 against your live URL.