Skip to content

[BUG]: When a toolkit import fails for any reason, subsequent attempts to import a toolkit with the same tool name are blocked #2987

@jyothika-johnson

Description

@jyothika-johnson

🐞 Bug Summary

When a toolkit import fails for any reason (e.g., 500 Internal Server Error), the system retains the failed toolkit name in the gateway registry. Subsequent attempts to import a toolkit with the same tool name are blocked with "Gateway name already exists" error, or "Unable to process input" error, even though the initial import did not complete successfully.

The rootcause seems to be that:

  • Gateway name is inserted with db.flush() before validation
  • When validation fails, db.rollback() is called
  • However, the gateway name may remain in a "reserved" state due to:
    • Database constraint caching
    • Incomplete rollback of unique constraints
    • Session state not properly cleared
  1. MCP Context Forge creates gateway record with db.flush() before validating tool schemas
  2. Schema validation fails (e.g., invalid exclusiveMinimum: true instead of number)
  3. MCP Context Forge returns 400 error, but gateway name remains reserved
  4. WXO database correctly rolls back (no toolkit created)

🔁 Steps to Reproduce

  1. Attempt to import a toolkit using the CLI command:

orchestrate toolkits add -k mcp -n process_inventory_items_mcp_remote_1 \ --description "Remote MCP server for Processing inventory items" \ -u https://complex-tools-openapi-1.onrender.com/mcp/ \ --transport streamable_http \ --tools '*'

  1. Observe that the import fails with a 500 Internal Server Error
  2. Attempt to import the same toolkit again with the same name
  3. Observe "Gateway name already exists" error
  4. Attempt to remove the toolkit using orchestrate toolkits remove -n process_inventory_items_mcp_remote_1
  5. Observe that the toolkit is not found, yet the name remains reserved

📓 Logs / Error Output:

Entry in MCP-Context Forge db:

Image

No entry in wxo-server db:

Image

MCP-Context Forge Logs:

{"asctime": "2026-02-17T07:00:30", "name": "mcp.client.streamable_http", "levelname": "DEBUG", "message": "Connecting to StreamableHTTP endpoint: https://complex-tools-openapi-1.onrender.com/mcp/", "@timestamp": "2026-02-17T07:00:30.883357Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:30", "name": "mcp.client.streamable_http", "levelname": "DEBUG", "message": "Sending client message: root=JSONRPCRequest(method='initialize', params={'protocolVersion': '2025-11-25', 'capabilities': {}, 'clientInfo': {'name': 'mcp', 'version': '0.1.0'}}, jsonrpc='2.0', id=0)", "@timestamp": "2026-02-17T07:00:30.884987Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:30", "name": "httpcore.connection", "levelname": "DEBUG", "message": "connect_tcp.started host='complex-tools-openapi-1.onrender.com' port=443 local_address=None timeout=30 socket_options=None", "@timestamp": "2026-02-17T07:00:30.886660Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:30", "name": "httpcore.connection", "levelname": "DEBUG", "message": "connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0xffff88bd9e20>", "@timestamp": "2026-02-17T07:00:30.957172Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:30", "name": "httpcore.connection", "levelname": "DEBUG", "message": "start_tls.started ssl_context=<ssl.SSLContext object at 0xffff88a795d0> server_hostname='complex-tools-openapi-1.onrender.com' timeout=30", "@timestamp": "2026-02-17T07:00:30.957342Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.connection", "levelname": "DEBUG", "message": "start_tls.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0xffff88bd9c10>", "@timestamp": "2026-02-17T07:00:31.026114Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_headers.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.026846Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_headers.complete", "@timestamp": "2026-02-17T07:00:31.027514Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_body.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.027600Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_body.complete", "@timestamp": "2026-02-17T07:00:31.027880Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_headers.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.028084Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Tue, 17 Feb 2026 07:00:31 GMT'), (b'Content-Type', b'application/json; charset=utf-8'), (b'Content-Length', b'128'), (b'Connection', b'keep-alive'), (b'CF-RAY', b'9cf3687f596d8356-SIN'), (b'access-control-allow-credentials', b'true'), (b'access-control-allow-origin', b'*'), (b'Content-Encoding', b'br'), (b'etag', b'W/\"a2-e/M98NvyxlfDANmwVCCNXowMPqg\"'), (b'rndr-id', b'cfe332b4-b0e2-4672'), (b'vary', b'Accept-Encoding'), (b'x-powered-by', b'Express'), (b'x-render-origin-server', b'Render'), (b'cf-cache-status', b'DYNAMIC'), (b'Server', b'cloudflare'), (b'alt-svc', b'h3=\":443\"; ma=86400')])", "@timestamp": "2026-02-17T07:00:31.408175Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpx", "levelname": "INFO", "message": "HTTP Request: POST https://complex-tools-openapi-1.onrender.com/mcp/ \"HTTP/1.1 200 OK\"", "@timestamp": "2026-02-17T07:00:31.410177Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_body.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.411433Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_body.complete", "@timestamp": "2026-02-17T07:00:31.419391Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "response_closed.started", "@timestamp": "2026-02-17T07:00:31.420771Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "response_closed.complete", "@timestamp": "2026-02-17T07:00:31.421451Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "mcp.client.streamable_http", "levelname": "INFO", "message": "Negotiated protocol version: 2024-11-05", "@timestamp": "2026-02-17T07:00:31.422787Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "mcp.client.streamable_http", "levelname": "DEBUG", "message": "Sending client message: root=JSONRPCNotification(method='notifications/initialized', params=None, jsonrpc='2.0')", "@timestamp": "2026-02-17T07:00:31.425541Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_headers.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.427998Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_headers.complete", "@timestamp": "2026-02-17T07:00:31.429148Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_body.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.429391Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_body.complete", "@timestamp": "2026-02-17T07:00:31.429940Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_headers.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.430119Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Tue, 17 Feb 2026 07:00:31 GMT'), (b'Content-Type', b'application/json; charset=utf-8'), (b'Content-Length', b'33'), (b'Connection', b'keep-alive'), (b'CF-RAY', b'9cf368813b988356-SIN'), (b'access-control-allow-credentials', b'true'), (b'access-control-allow-origin', b'*'), (b'Content-Encoding', b'br'), (b'etag', b'W/\"1d-sN7BjObD8fV0F5JGlj1cZd6LJDc\"'), (b'rndr-id', b'effc1b3e-5ed6-458e'), (b'vary', b'Accept-Encoding'), (b'x-powered-by', b'Express'), (b'x-render-origin-server', b'Render'), (b'cf-cache-status', b'DYNAMIC'), (b'Server', b'cloudflare'), (b'alt-svc', b'h3=\":443\"; ma=86400')])", "@timestamp": "2026-02-17T07:00:31.792778Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpx", "levelname": "INFO", "message": "HTTP Request: POST https://complex-tools-openapi-1.onrender.com/mcp/ \"HTTP/1.1 200 OK\"", "@timestamp": "2026-02-17T07:00:31.793563Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "response_closed.started", "@timestamp": "2026-02-17T07:00:31.794353Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "response_closed.complete", "@timestamp": "2026-02-17T07:00:31.796067Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "mcp.client.streamable_http", "levelname": "DEBUG", "message": "Sending client message: root=JSONRPCRequest(method='tools/list', params=None, jsonrpc='2.0', id=1)", "@timestamp": "2026-02-17T07:00:31.797168Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.connection", "levelname": "DEBUG", "message": "connect_tcp.started host='complex-tools-openapi-1.onrender.com' port=443 local_address=None timeout=30 socket_options=None", "@timestamp": "2026-02-17T07:00:31.799432Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.connection", "levelname": "DEBUG", "message": "connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0xffff88bda900>", "@timestamp": "2026-02-17T07:00:31.901562Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.connection", "levelname": "DEBUG", "message": "start_tls.started ssl_context=<ssl.SSLContext object at 0xffff88a795d0> server_hostname='complex-tools-openapi-1.onrender.com' timeout=30", "@timestamp": "2026-02-17T07:00:31.901776Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.connection", "levelname": "DEBUG", "message": "start_tls.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0xffff88bdb4d0>", "@timestamp": "2026-02-17T07:00:31.979054Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_headers.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.979546Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_headers.complete", "@timestamp": "2026-02-17T07:00:31.979778Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_body.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.979851Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "send_request_body.complete", "@timestamp": "2026-02-17T07:00:31.980006Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:31", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_headers.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:31.980054Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Tue, 17 Feb 2026 07:00:32 GMT'), (b'Content-Type', b'application/json; charset=utf-8'), (b'Content-Length', b'901'), (b'Connection', b'keep-alive'), (b'CF-RAY', b'9cf3688549a8f922-SIN'), (b'access-control-allow-credentials', b'true'), (b'access-control-allow-origin', b'*'), (b'Content-Encoding', b'br'), (b'etag', b'W/\"a76-aityqdS5sz/Wqk/Mw35Yr4tmkUw\"'), (b'rndr-id', b'f80385b7-54c6-450b'), (b'vary', b'Accept-Encoding'), (b'x-powered-by', b'Express'), (b'x-render-origin-server', b'Render'), (b'cf-cache-status', b'DYNAMIC'), (b'Server', b'cloudflare'), (b'alt-svc', b'h3=\":443\"; ma=86400')])", "@timestamp": "2026-02-17T07:00:32.905703Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpx", "levelname": "INFO", "message": "HTTP Request: POST https://complex-tools-openapi-1.onrender.com/mcp/ \"HTTP/1.1 200 OK\"", "@timestamp": "2026-02-17T07:00:32.906001Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_body.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:00:32.906139Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_body.complete", "@timestamp": "2026-02-17T07:00:32.906305Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpcore.http11", "levelname": "DEBUG", "message": "response_closed.started", "@timestamp": "2026-02-17T07:00:32.906479Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpcore.http11", "levelname": "DEBUG", "message": "response_closed.complete", "@timestamp": "2026-02-17T07:00:32.906583Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "mcpgateway.services.gateway_service", "levelname": "INFO", "message": "Fetched 2 tools from gateway", "@timestamp": "2026-02-17T07:00:32.908170Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpcore.connection", "levelname": "DEBUG", "message": "close.started", "@timestamp": "2026-02-17T07:00:32.908879Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "httpcore.connection", "levelname": "DEBUG", "message": "close.complete", "@timestamp": "2026-02-17T07:00:32.909102Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "mcpgateway.db", "levelname": "WARNING", "message": "Invalid tool input schema: True is not of type 'number'\n\nFailed validating 'type' in metaschema['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][1]['properties']['items']['$dynamicRef']['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][3]['properties']['exclusiveMinimum']:\n    {'type': 'number'}\n\nOn schema['properties']['items']['items']['properties']['price']['exclusiveMinimum']:\n    True", "@timestamp": "2026-02-17T07:00:32.919710Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "mcpgateway.services.gateway_service", "levelname": "ERROR", "message": "ValueErrors in group: (ValueError(\"Invalid tool input schema: True is not of type 'number'\\n\\nFailed validating 'type' in metaschema['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][1]['properties']['items']['$dynamicRef']['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][3]['properties']['exclusiveMinimum']:\\n    {'type': 'number'}\\n\\nOn schema['properties']['items']['items']['properties']['price']['exclusiveMinimum']:\\n    True\"),)", "@timestamp": "2026-02-17T07:00:32.920773Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "mcpgateway.services.structured_logger", "levelname": "ERROR", "message": "[gateway_service] Gateway creation failed due to validation error", "component": "gateway_service", "category": null, "user_id": "7566e7d8-2f5e-4864-8cc0-f109457738eb@wxo.com", "user_email": "7566e7d8-2f5e-4864-8cc0-f109457738eb@wxo.com", "team_id": null, "duration_ms": null, "custom_fields": {"gateway_name": "process_inventory_items_mcp_remote_1"}, "tags": null, "error_type": "ValueError", "error_message": "Invalid tool input schema: True is not of type 'number'\n\nFailed validating 'type' in metaschema['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][1]['properties']['items']['$dynamicRef']['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][3]['properties']['exclusiveMinimum']:\n    {'type': 'number'}\n\nOn schema['properties']['items']['items']['properties']['price']['exclusiveMinimum']:\n    True", "error_stack_trace": "Traceback (most recent call last):\n  File \"/app/mcpgateway/db.py\", line 5344, in validate_tool_schema\n    validator_cls.check_schema(schema)\n  File \"/app/.venv/lib64/python3.12/site-packages/jsonschema/validators.py\", line 316, in check_schema\n    raise exceptions.SchemaError.create_from(error)\njsonschema.exceptions.SchemaError: True is not of type 'number'\n\nFailed validating 'type' in metaschema['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][1]['properties']['items']['$dynamicRef']['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][3]['properties']['exclusiveMinimum']:\n    {'type': 'number'}\n\nOn schema['properties']['items']['items']['properties']['price']['exclusiveMinimum']:\n    True\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"/app/mcpgateway/services/gateway_service.py\", line 1100, in register_gateway\n    db.flush()  # Flush to get the ID without committing\n    ^^^^^^^^^^\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/session.py\", line 4331, in flush\n    self._flush(objects)\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/session.py\", line 4466, in _flush\n    with util.safe_reraise():\n         ^^^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/util/langhelpers.py\", line 224, in __exit__\n    raise exc_value.with_traceback(exc_tb)\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/session.py\", line 4427, in _flush\n    flush_context.execute()\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/unitofwork.py\", line 466, in execute\n    rec.execute(self)\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/unitofwork.py\", line 642, in execute\n    util.preloaded.orm_persistence.save_obj(\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/persistence.py\", line 68, in save_obj\n    ) in _organize_states_for_save(base_mapper, states, uowtransaction):\n         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/persistence.py\", line 234, in _organize_states_for_save\n    mapper.dispatch.before_insert(mapper, connection, state)\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/event/attr.py\", line 515, in __call__\n    fn(*args, **kw)\n  File \"/app/.venv/lib64/python3.12/site-packages/sqlalchemy/orm/events.py\", line 892, in wrap\n    fn(*arg, **kw)\n  File \"/app/mcpgateway/db.py\", line 5348, in validate_tool_schema\n    raise ValueError(f\"Invalid tool input schema: {str(e)}\") from e\nValueError: Invalid tool input schema: True is not of type 'number'\n\nFailed validating 'type' in metaschema['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][1]['properties']['items']['$dynamicRef']['allOf'][1]['properties']['properties']['additionalProperties']['$dynamicRef']['allOf'][3]['properties']['exclusiveMinimum']:\n    {'type': 'number'}\n\nOn schema['properties']['items']['items']['properties']['price']['exclusiveMinimum']:\n    True\n", "event_type": "gateway_creation_failed", "correlation_id": "fbeecc2c7a0d489abd942823f8d0bf2a", "hostname": "f34a0a667cd3", "process_id": 1, "timestamp": "2026-02-17T07:00:32.926052+00:00", "@timestamp": "2026-02-17T07:00:32.926162Z", "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] Auth audit: POST /gateways -> 400 (auth_present=True, client=192.168.97.5)", "@timestamp": "2026-02-17T07:00:32.927302Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "mcpgateway.services.structured_logger", "levelname": "WARNING", "message": "[http_gateway] Request completed: POST /gateways - 400", "component": "http_gateway", "category": null, "user_id": null, "user_email": null, "team_id": null, "duration_ms": 2128.5362243652344, "custom_fields": null, "tags": null, "correlation_id": "fbeecc2c7a0d489abd942823f8d0bf2a", "operation_type": "http_request", "request_method": "POST", "request_path": "/gateways", "response_status_code": 400, "user_agent": "python-requests/2.32.5", "client_ip": "192.168.97.5", "metadata": {"event": "request_completed", "response_time_category": "slow"}, "hostname": "f34a0a667cd3", "process_id": 1, "timestamp": "2026-02-17T07:00:32.928005+00:00", "@timestamp": "2026-02-17T07:00:32.928026Z", "request_id": "fbeecc2c7a0d489abd942823f8d0bf2a"}
{"asctime": "2026-02-17T07:00:32", "name": "uvicorn.access", "levelname": "INFO", "message": "192.168.97.5:38760 - \"POST /gateways HTTP/1.1\" 400", "@timestamp": "2026-02-17T07:00:32.928402Z", "hostname": "f34a0a667cd3", "process_id": 1}

Logs for scenario 2:

{"asctime": "2026-02-17T07:20:47", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_headers.complete return_value=(b'HTTP/1.1', 202, b'Accepted', [(b'content-length', b'8'), (b'content-type', b'text/plain; charset=utf-8'), (b'date', b'Tue, 17 Feb 2026 07:20:46 GMT'), (b'server', b'uvicorn'), (b'strict-transport-security', b'max-age=63072000; preload')])", "@timestamp": "2026-02-17T07:20:47.067495Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "b06e265ee731483483270845f9cfdb12"}
{"asctime": "2026-02-17T07:20:47", "name": "httpx", "levelname": "INFO", "message": "HTTP Request: POST https://weather-mcp-server.1ztdssb3chnz.us-south.codeengine.appdomain.cloud/messages/?session_id=57ec736833db4e819b9d5e25091924d4 \"HTTP/1.1 202 Accepted\"", "@timestamp": "2026-02-17T07:20:47.067679Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "b06e265ee731483483270845f9cfdb12"}
{"asctime": "2026-02-17T07:20:47", "name": "httpcore.http11", "levelname": "DEBUG", "message": "receive_response_body.started request=<Request [b'POST']>", "@timestamp": "2026-02-17T07:20:47.067750Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "b06e265ee731483483270845f9cfdb12"}


{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] User 'wxo.archer@ibm.com' already has platform_admin role", "@timestamp": "2026-02-17T07:21:56.844515Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] Generating team token for user_email='wxo.archer@ibm.com', team_id=54938fc6bd5f49f2b42dab36cfeec474, team_slug='7566e7d8-2f5e-4864-8cc0-f109457738eb'", "@timestamp": "2026-02-17T07:21:56.844619Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "WARNING", "message": "[WXO_AUTH] TOKEN_ENCRYPTION_KEY not found, using JWT_SECRET_KEY for token encryption", "@timestamp": "2026-02-17T07:21:56.847209Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] Reusing valid cached tenant-scoped team token for team '7566e7d8-2f5e-4864-8cc0-f109457738eb'", "@timestamp": "2026-02-17T07:21:56.853533Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] Generated/retrieved team token for team '7566e7d8-2f5e-4864-8cc0-f109457738eb' (tenant: 7566e7d8-2f5e-4864-8cc0-f109457738eb)", "@timestamp": "2026-02-17T07:21:56.853869Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] \u2705 Updated Authorization header with team token", "@timestamp": "2026-02-17T07:21:56.854223Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] \u2705 Injected team headers in pre_request: ['host', 'user-agent', 'accept-encoding', 'accept', 'connection', 'authorization', 'x-ibm-wo-transaction-id', 'content-type', 'content-length', 'X-Team-Id', 'X-Tenant-Id', 'X-Team-Slug', 'X-Team-Token', 'X-WXO-Access-Token']", "@timestamp": "2026-02-17T07:21:56.854290Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.services.gateway_service", "levelname": "ERROR", "message": "GatewayNameConflictError in group: (GatewayNameConflictError('Team-level Gateway already exists with name: weatherserver1'),)", "@timestamp": "2026-02-17T07:21:56.870284Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.services.structured_logger", "levelname": "WARNING", "message": "[gateway_service] Gateway creation failed due to name conflict", "component": "gateway_service", "category": null, "user_id": "7566e7d8-2f5e-4864-8cc0-f109457738eb@wxo.com", "user_email": "7566e7d8-2f5e-4864-8cc0-f109457738eb@wxo.com", "team_id": null, "duration_ms": null, "custom_fields": {"gateway_name": "weatherserver1", "visibility": "team"}, "tags": null, "event_type": "gateway_name_conflict", "correlation_id": "887c855a88264251bbf4ee992248998e", "hostname": "f34a0a667cd3", "process_id": 1, "timestamp": "2026-02-17T07:21:56.870458+00:00", "@timestamp": "2026-02-17T07:21:56.870501Z", "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.plugins.auth_pre_check", "levelname": "INFO", "message": "[WXO_AUTH] Auth audit: POST /gateways -> 409 (auth_present=True, client=192.168.97.5)", "@timestamp": "2026-02-17T07:21:56.871191Z", "hostname": "f34a0a667cd3", "process_id": 1, "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "mcpgateway.services.structured_logger", "levelname": "WARNING", "message": "[http_gateway] Request completed: POST /gateways - 409", "component": "http_gateway", "category": null, "user_id": null, "user_email": null, "team_id": null, "duration_ms": 41.300296783447266, "custom_fields": null, "tags": null, "correlation_id": "887c855a88264251bbf4ee992248998e", "operation_type": "http_request", "request_method": "POST", "request_path": "/gateways", "response_status_code": 409, "user_agent": "python-requests/2.32.5", "client_ip": "192.168.97.5", "metadata": {"event": "request_completed", "response_time_category": "fast"}, "hostname": "f34a0a667cd3", "process_id": 1, "timestamp": "2026-02-17T07:21:56.871441+00:00", "@timestamp": "2026-02-17T07:21:56.871454Z", "request_id": "887c855a88264251bbf4ee992248998e"}
{"asctime": "2026-02-17T07:21:56", "name": "uvicorn.access", "levelname": "INFO", "message": "192.168.97.5:58708 - \"POST /gateways HTTP/1.1\" 409", "@timestamp": "2026-02-17T07:21:56.871711Z", "hostname": "f34a0a667cd3", "process_id": 1}

Example with weatherserver:

Image

Example with process_inventory_items_mcp_remote_1:
Image

Expected Behavior
If a toolkit import fails, the gateway name should not be reserved/persisted in the system.

Actual Behaviour

  • Failed toolkit imports leave the gateway name in a reserved state in MCP Context Forge
  • The gateway exists in MCP Context Forge database but NOT in WXO database (orphaned state)
  • Subsequent import attempts with the same name are blocked

Metadata

Metadata

Labels

triageIssues / Features awaiting triagewxowxo integration

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions