From ffa2b1a72db157345bafc8db7b1dff880c223643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Tailland?= Date: Sat, 29 Aug 2026 12:19:35 +0200 Subject: [PATCH] fix(mcp): translate OpenAPI 3.0 nullable into JSON Schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The response schemas added yesterday made every paginated list tool fail. The plugin's fields are documented as OpenAPI format and validated with a JSON Schema validator, and `nullable: true` is not a JSON Schema keyword — so it is ignored, `type: string` is enforced, and `previous: null` on the first page is rejected as *null is not of type "string"*. The failure lands after the backend has already done the work, surfaces to the caller as a bare tool retry exhaustion, and appears nowhere in the gateway's own logs. Found only because an orchestrating agent asked a question that paged. The generator now rewrites `nullable: true` into `type: [T, "null"]` wherever it inlines a schema, request bodies included. A 3.1 spec needs none of this. Co-Authored-By: Claude Opus 5 --- kong/mcp/ai-mcp-proxy.yaml | 60 +++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/kong/mcp/ai-mcp-proxy.yaml b/kong/mcp/ai-mcp-proxy.yaml index 02b34b8..054ced2 100644 --- a/kong/mcp/ai-mcp-proxy.yaml +++ b/kong/mcp/ai-mcp-proxy.yaml @@ -58,13 +58,15 @@ config: type: integer example: 123 next: - type: string - nullable: true + type: + - string + - 'null' format: uri example: http://api.example.org/accounts/?page=4 previous: - type: string - nullable: true + type: + - string + - 'null' format: uri example: http://api.example.org/accounts/?page=2 results: @@ -84,15 +86,17 @@ config: type: string format: date shippeddate: - type: string + type: + - string + - 'null' format: date - nullable: true status: type: string maxLength: 15 comments: - type: string - nullable: true + type: + - string + - 'null' customernumber: type: integer maximum: 2147483647 @@ -148,15 +152,17 @@ config: type: string format: date shippeddate: - type: string + type: + - string + - 'null' format: date - nullable: true status: type: string maxLength: 15 comments: - type: string - nullable: true + type: + - string + - 'null' customernumber: type: integer maximum: 2147483647 @@ -217,13 +223,15 @@ config: type: integer example: 123 next: - type: string - nullable: true + type: + - string + - 'null' format: uri example: http://api.example.org/accounts/?page=4 previous: - type: string - nullable: true + type: + - string + - 'null' format: uri example: http://api.example.org/accounts/?page=2 results: @@ -323,15 +331,17 @@ config: type: string format: date shippeddate: - type: string + type: + - string + - 'null' format: date - nullable: true status: type: string maxLength: 15 comments: - type: string - nullable: true + type: + - string + - 'null' customernumber: type: integer maximum: 2147483647 @@ -385,13 +395,15 @@ config: type: integer example: 123 next: - type: string - nullable: true + type: + - string + - 'null' format: uri example: http://api.example.org/accounts/?page=4 previous: - type: string - nullable: true + type: + - string + - 'null' format: uri example: http://api.example.org/accounts/?page=2 results: