Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

test: cover wrong JSON types in the MCP robustness layer

Mohak Guptaf8d48559139e
diff --git a/scripts/security-fuzz.sh b/scripts/security-fuzz.sh
index 52ed25c54..bdf1ca58d 100755
--- a/scripts/security-fuzz.sh
+++ b/scripts/security-fuzz.sh
@@ -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 ---"