Skip to content

[Bug]: When I define a tag on an MCP Server tool invocation fails #1553

@popagruia

Description

@popagruia

🐞 Bug Summary

Briefly describe the issue or unexpected behavior.


🧩 Affected Component

Select the area of the project impacted:

  • [ x] 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. Added a mcp server with authentication using OAUTH2 like GitHub,com server
  2. Create any tag on the server
  3. Use an agent that invokes a tool on the server
  4. The call fails and I can see an exception in log
  5. Edit the added GW. In the tag field is displayed [object Object]

🤔 Expected Behavior

Successful call.


📓 Logs / Error Output

Paste any relevant stack traces or logs here.
⚠️ Do not paste secrets, credentials, or tokens.
2025-12-04 18:13:42,499 - mcpgateway.services.tool_service - INFO - Invoking tool: github-com-list-issues with arguments: dict_keys(['owner', 'repo']) and headers: dict_keys(['host', 'accept-encoding', 'connection', 'user-agent', 'accept', 'content-type', 'authorization', 'x-vault-tokens', 'mcp-protocol-version', 'content-length'])
2025-12-04 18:13:42,631 - mcpgateway.transports.streamablehttp_transport - ERROR - Error calling tool 'github-com-list-issues': Tool invocation failed: 1 validation error for Gateway
tags.0
Input should be a valid string [type=string_type, input_value={'id': 'system', 'label': 'system'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/string_type
Traceback (most recent call last):
File "/Users/adrianpopa/mcp-context-forge/mcpgateway/services/tool_service.py", line 1478, in invoke_tool
gateway_metadata = PydanticGateway.model_validate(tool_gateway)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/adrianpopa/mcp-context-forge/.venv/lib/python3.11/site-packages/pydantic/main.py", line 716, in model_validate
return cls.pydantic_validator.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Gateway
tags.0
Input should be a valid string [type=string_type, input_value={'id': 'system', 'label': 'system'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/string_type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/adrianpopa/mcp-context-forge/mcpgateway/transports/streamablehttp_transport.py", line 400, in call_tool
result = await tool_service.invoke_tool(db=db, name=name, arguments=arguments, request_headers=request_headers, app_user_email=app_user_email)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/adrianpopa/mcp-context-forge/mcpgateway/services/tool_service.py", line 1547, in invoke_tool
raise ToolInvocationError(f"Tool invocation failed: {error_message}")
mcpgateway.services.tool_service.ToolInvocationError: Tool invocation failed: 1 validation error for Gateway
tags.0
Input should be a valid string [type=string_type, input_value={'id': 'system', 'label': 'system'}, input_type=dict]

🧠 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

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