Merge pull request #1521 from lukiod/test/mcp-fuzz-wrong-types

test: cover wrong JSON types in the MCP robustness layer
This commit is contained in:
Martin Vogel authored and GitHub committed 2026-08-14 17:04:16 +02:00
commit a6afd156b7
1 file changed
+13
+13
View File
@@ -115,6 +115,19 @@ test_payload "wrong jsonrpc version" '{"jsonrpc":"1.0","id":2,"method":"tools/ca
test_payload "array instead of object" '[1,2,3]'
test_payload "deeply nested json" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":{"name_pattern":{"a":{"b":{"c":{"d":{"e":{"f":"deep"}}}}}}}}}'
echo ""
echo "--- Wrong JSON types ---"
test_payload "null tool name" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":null,"arguments":{}}}'
test_payload "numeric tool name" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":42,"arguments":{}}}'
test_payload "object tool name" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":{"a":1},"arguments":{}}}'
test_payload "array arguments" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":[1,2]}}'
test_payload "string arguments" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":"nope"}}'
test_payload "null arguments" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":null}}'
test_payload "array params" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":[1,2]}'
test_payload "numeric params" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":7}'
test_payload "numeric method" '{"jsonrpc":"2.0","id":2,"method":7,"params":{}}'
echo ""
echo "--- Oversized inputs ---"