Skip to content

[Bug]: 0.9.0- Tools -> Add Tool from REST API adding incorrect input schema is breaking GET tools UI and API #1430

@omprak

Description

@omprak

🐞 Bug Summary

Briefly describe the issue or unexpected behavior.

I was trying to import REST APIs and added incorrect schema format which gave errors and finally stopped showing any tools in UI and 500 internal server from List Tools API.

This is major issue as its breaking whole system by giving 500 for tools call.
Error is -Failed to convert tool XXXXXXXXXXX to schema: coroutine raised StopIteration and its throwing 500.

I was able to delete


🧩 Affected Component

Select the area of the project impacted:

  • mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • Other (explain below)

🔁 Steps to Reproduce

  1. .Add a new tool from REST API and input schema was incorrect .Error was shown in UI.
  2. All tools were disappeared from UI and API with 500 internal error
  3. error is -Failed to convert tool XXXXXXXXXXX to schema: coroutine raised StopIteration

🤔 Expected Behavior

What should have happened instead? Tool add should work from REST API


📓 Logs / Error Output

Paste any relevant stack traces or logs here.
⚠️ Do not paste secrets, credentials, or tokens.
2025-11-12 16:09:38,365 - uvicorn.access - INFO - 10.134.90.205:0 - "GET /mcpgateway/tools/?include_inactive=false HTTP/1.1" 500
2025-11-12 16:09:38,365 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
File "/app/mcpgateway/services/tool_service.py", line 783, in list_tools
result.append(self._convert_tool_to_read(t))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/mcpgateway/services/tool_service.py", line 377, in _convert_tool_to_read
"auth_header_key": next(iter(decoded_auth_value)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

File "/app/.venv/lib64/python3.12/site-packages/fastapi/routing.py", line 391, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib64/python3.12/site-packages/fastapi/routing.py", line 290, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/mcpgateway/middleware/rbac.py", line 295, in wrapper
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/mcpgateway/main.py", line 2335, in list_tools
data, _ = await tool_service.list_tools(db, cursor=cursor, include_inactive=include_inactive, tags=tags_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

          {

"detail": "coroutine raised StopIteration"
}

2025-11-12 16:22:14,929 - mcpgateway.admin - WARNING - Failed to convert tool XXXXXXXXXXX to schema: coroutine raised StopIteration


🧠 Environment Info

You can retrieve most of this from the /version endpoint.

Key Value
Version or commit e.g. v0.9.0 or main@a1b2c3d
Runtime e.g. Python 3.11, Gunicorn
Platform / OS e.g. Ubuntu 22.04, macOS
Container e.g. Docker, Podman, none

🧩 Additional Context (optional)

Add any configuration details, flags, or related issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssues / Features awaiting triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions