Files
kong-payments-api/kong/mcp/ai-mcp-proxy.yaml
T
Stéphane Tailland de31e0cd39 fix(mcp): translate OpenAPI 3.0 nullable into JSON Schema
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 <noreply@anthropic.com>
2026-08-29 12:19:33 +02:00

230 lines
6.5 KiB
YAML

# GENERATED — do not edit. Edit openapi.yaml or tools-policy.yaml, then:
# k8s-platform/tools/generate-mcp-tools.py <this domain>
#
# Produced by `deck file openapi2mcp`, then post-processed to add the ACLs,
# the MCP behavioural annotations, the response schemas, the real upstream
# host and the JSON-only bodies that Kong's generator does not emit. Each of
# those is a documented gap — see k8s-platform/MCP-TOOL-GENERATION.md.
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: ${NAME}-payments-mcp-ai-mcp-proxy
namespace: ${NAMESPACE}
plugin: ai-mcp-proxy
config:
mode: conversion-listener
include_consumer_groups: true
tools:
- annotations:
title: List all payments
read_only_hint: true
idempotent_hint: true
destructive_hint: false
open_world_hint: false
description: Retrieve a paginated list of all customer payment records with amounts and dates.
method: GET
name: list-payments
parameters:
- description: A page number within the paginated result set.
in: query
name: page
required: false
schema:
type: integer
- description: Number of results to return per page.
in: query
name: page_size
required: false
schema:
type: integer
path: /payments/v1/payments/
acl:
allow:
- admin
- read_only
- product_manager
- customer
- support
scheme: http
host: ${REST_HOSTNAME}
responses:
'200':
content:
application/json:
schema:
type: object
properties:
count:
type: integer
example: 123
next:
type:
- string
- 'null'
format: uri
example: http://api.example.org/accounts/?page=4
previous:
type:
- string
- 'null'
format: uri
example: http://api.example.org/accounts/?page=2
results:
type: array
items:
type: object
description: Customer payment records
properties:
id:
type: integer
readOnly: true
checknumber:
type: string
maxLength: 50
paymentdate:
type: string
format: date
amount:
type: string
format: decimal
pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
customernumber:
type: integer
maximum: 2147483647
minimum: -2147483648
required:
- amount
- checknumber
- customernumber
- id
- paymentdate
- annotations:
title: Get a specific payment
read_only_hint: true
idempotent_hint: true
destructive_hint: false
open_world_hint: false
description: Retrieve detailed information about a specific payment by customer number and check number.
method: GET
name: get-payment
parameters:
- description: The check number
in: path
name: checknumber
required: true
schema:
type: string
- description: The customer number
in: path
name: customernumber
required: true
schema:
type: integer
path: /payments/v1/payments/{customernumber}/{checknumber}/
acl:
allow:
- admin
- read_only
- product_manager
- customer
- support
scheme: http
host: ${REST_HOSTNAME}
responses:
'200':
content:
application/json:
schema:
type: object
description: Customer payment records
properties:
id:
type: integer
readOnly: true
checknumber:
type: string
maxLength: 50
paymentdate:
type: string
format: date
amount:
type: string
format: decimal
pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
customernumber:
type: integer
maximum: 2147483647
minimum: -2147483648
required:
- amount
- checknumber
- customernumber
- id
- paymentdate
- annotations:
title: Create a new payment
read_only_hint: false
idempotent_hint: false
destructive_hint: false
open_world_hint: false
description: Record a new customer payment with check number, amount, and payment date.
method: POST
name: create-payment
path: /payments/v1/payments/
request_body:
content:
application/json:
schema:
properties:
amount:
type: string
checknumber:
type: string
customernumber:
type: integer
paymentdate:
type: string
required:
- amount
- checknumber
- customernumber
- paymentdate
type: object
required: true
acl:
allow:
- admin
scheme: http
host: ${REST_HOSTNAME}
responses:
'201':
content:
application/json:
schema:
type: object
description: Customer payment records
properties:
id:
type: integer
readOnly: true
checknumber:
type: string
maxLength: 50
paymentdate:
type: string
format: date
amount:
type: string
format: decimal
pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
customernumber:
type: integer
maximum: 2147483647
minimum: -2147483648
required:
- amount
- checknumber
- customernumber
- id
- paymentdate