NumPy allowed · plain Python earns 10 bonus points
Implement JSON-RPC 2.0 request validation, the transport-level contract MCP is built directly on top of.
Implement is_valid_jsonrpc_request(message). A valid request has EXACTLY: jsonrpc equal to the string '2.0', a method key whose value is a non-empty string, and (if present) a params key that is a dict or list. id is optional (its absence marks it a notification) but if present must be a str, int, or None. Return True only if all present fields satisfy these rules.
is_valid_jsonrpc_request(message: dict) -> bool