part…
Building governance for MCP?
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
MCP uses JSON Schema in the inputSchema and outputSchema of tools, in the requestedSchema of elicitation (a restricted subset) and in the validation of structuredContent. The spec fixes the default dialect and, above all, limits what an implementation may do with $ref because a schema is untrusted input.
JSON Schema is a standard independent of MCP: a language, written in JSON, for describing the shape another JSON document must have. A schema says which fields exist, what type they are, which are mandatory and which constraints they satisfy. A validator takes the schema and a piece of data, and answers whether the data conforms or not.
{ "type": "object",
"properties": { "query": { "type": "string" }, "limit": { "type": "integer", "minimum": 1 } },
"required": ["query"] }
With that schema, { "query": "actas 2026", "limit": 10 } is valid; { "limit": "ten" } is not (query is missing and limit is not an integer).
Who writes the schema and who reads it. The flow is always the same:
tools/list.inputSchema (and optionally outputSchema). That inputSchema is a complete JSON Schema document, written by the server.tools/call, validates the arguments against it before sending them.MCP needs this because the model cannot guess which arguments a tool accepts: the server publishes the schema and the host uses it to build the call and to validate it. The standard has had several versions (draft-07, 2019-09, 2020-12), called dialects, with small differences in keywords; hence the spec has to fix which one is assumed by default.
For the platform, the key point is that the schema is written by the server, so it is untrusted input. Two features of the standard are exploitable: $ref allows pointing to an external URL (SSRF risk if the validator downloads it), and the composition keywords (anyOf, allOf, deep nesting) allow building schemas whose validation is extremely expensive (DoS risk). The rest of the lesson revolves around those two limits.
$schema field, the dialect is JSON Schema 2020-12 (SEP-1613).$schema (e.g. draft-07).$schema is a key inside the schema itself, so it is written by the server and travels in the response to tools/list. The client reads it to know which rules to validate with. Its value is a URL identifying the version of the standard, not a resource to be downloaded. In practice almost nobody includes it, because the default value is already the recommended one. This is what the exceptional case of a server writing its schemas in draft-07 would look like:
{
"tools": [
{
"name": "buscar_acta",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": { "name": { "type": "string" } },
"required": ["name"]
}
}
]
}
$ref resolution2020-12 allows $ref to absolute URIs. Implementations MUST NOT automatically dereference $refs that point to a network URI.
$ref SHOULD be rejected, not treated as permissive.anyOf, oneOf, allOf, if/then/else and $defs can make validation very expensive. Implementations SHOULD apply reasonable limits: maximum depth, total number of sub-schemas, time budget per validation. The explicit goal is to prevent a malicious schema from using the validator as a denial-of-service vector.
inputSchema and outputSchema admit any 2020-12 keyword, and structuredContent may be any JSON value (object, array, string, number, boolean or null) conforming to outputSchema. Previously they were restricted to objects.
For a tool without arguments, valid forms:
{ "type": "object", "additionalProperties": false } (recommended: only accepts {}).{ "type": "object" } (accepts any object).inputSchema MUST be a valid schema object, never null.
requestedSchema in form mode is limited to a flat object with primitive properties: string (with format email/uri/date/date-time, minLength/maxLength), number/integer (minimum/maximum), boolean, and single/multi enums with or without titles (enum, oneOf+const, array of items.enum/anyOf+const), all with an optional default. No nesting and no arrays of objects.
tools/call arguments against inputSchema and structuredContent against outputSchema in the gateway, with a validator configured with depth and time limits and without resolution of external $refs.$ref; do not expose them to the host.requestedSchema of elicitations you pass to the host, and verify that it respects the flat subset.1. What is the default JSON Schema dialect in MCP when there is no $schema?
SEP-1613 fixes 2020-12 as the default dialect.
2. What must an implementation do with a $ref that points to a network URL?
Network resolution is forbidden by default because of SSRF and DoS risk.
3. Which inputSchema form does the spec recommend for a tool without parameters?
It must be a valid object schema; the recommended form accepts only the empty object.