Skip to content

[BUG]: A2A agent listing returns 500 in MCP Gateway /docs, preventing retrieval of agent_id; invoke test also fails with HTTP 500 #4624

@KaRtHiK-56

Description

@KaRtHiK-56

Title

A2A agent listing returns 500 in MCP Gateway /docs, preventing retrieval of agent_id; invoke test also fails with HTTP 500

🐞 Bug Summary

I created and registered an A2A agent successfully in IBM Context Forge, and the agent appears as active and reachable in the UI.

However, when testing the A2A APIs from the FastAPI MCP Gateway Swagger /docs page, the List A2A Agents endpoint (GET /a2a) returns 500 Internal Server Error instead of returning the registered agents. Because of this, I cannot get the agent_id required to test Get A2A Agent (GET /a2a/{agent_id}).

Additionally, after registration, invoking the agent from IBM Context Forge shows the agent card as active/reachable but the test execution fails with HTTP 500.


🧩 Affected Component

  • 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. Create an A2A agent and register it in IBM Context Forge.
  2. Confirm the agent is shown as up/running in the UI.
  3. Open the MCP Gateway Swagger docs:
    • https://maassist06-mcp-accesspoint.cp.manh.cloud/docs
  4. Navigate to the A2A Agents section and test the endpoints, especially:
    • GET /a2a
    • GET /a2a/{agent_id}
    • POST /a2a/{agent_name}/invoke
  5. Call List A2A Agents (GET /a2a).
  6. Observe that the request fails with 500 Internal Server Error.
  7. Check the deployment logs.
  8. Also, from the IBM Context Forge UI, try Test / Invoke for the registered agent.
  9. Observe the UI shows:
    • helloworld
    • Hello world A2A agent
    • Active
    • Reachable
    • Endpoint: http://localhost:8083/agent
    • Executions: 0 | Success Rate: N/A
    • ❌ Test Failed
    • Error: HTTP 500

🤔 Expected Behavior

  • GET /a2a should return the list of registered A2A agents visible to the authenticated user.
  • The response should include the agent metadata and agent_id, allowing follow-up calls such as GET /a2a/{agent_id}.
  • Invoking the registered A2A agent from IBM Context Forge should succeed instead of returning HTTP 500.

📓 Logs / Error Output

⚠️ No secrets, credentials, or tokens included below.

2026-05-06 08:57:14,784 - mcpgateway.services.team_management_service - ERROR - Failed to get teams for user {'email': 'admin@admin.com', 'full_name': 'Platform Administrator', 'is_admin': True, 'ip_address': '103.82.211.205', 'user_agent': 'Mozilla/5.0 ...', 'db': <sqlalchemy.orm.session.Session object at 0x...>}: (sqlite3.ProgrammingError) Error binding parameter 1: type 'dict' is not supported

SQL:
SELECT email_teams.id AS email_teams_id, email_teams.name AS email_teams_name, email_teams.slug AS email_teams_slug, email_teams.description AS email_teams_description, email_teams.created_by AS email_teams_created_by, email_teams.is_personal AS email_teams_is_personal, email_teams.visibility AS email_teams_visibility, email_teams.max_members AS email_teams_max_members, email_teams.created_at AS email_teams_created_at, email_teams.updated_at AS email_teams_updated_at, email_teams.is_active AS email_teams_is_active
FROM email_teams JOIN email_team_members ON email_teams.id = email_team_members.team_id
WHERE email_team_members.user_email = ? AND email_team_members.is_active IS 1 AND email_teams.is_active IS 1

parameters:
({'email': 'admin@admin.com', 'full_name': 'Platform Administrator', 'is_admin': True, ...},)

2026-05-06 08:57:14,790 - uvicorn.access - INFO - 103.82.211.205:0 - "GET /a2a HTTP/1.1" 500

Traceback (most recent call last):
  ...
  File "/app/mcpgateway/main.py", line 1677, in list_a2a_agents
    return await a2a_service.list_agents_for_user(db, user_email=user, team_id=team_id, visibility=visibility, include_inactive=include_inactive, skip=skip, limit=limit)
  ...
sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) Error binding parameter 1: type 'dict' is not supported

SQL:
SELECT a2a_agents.id, a2a_agents.name, a2a_agents.slug, a2a_agents.description, a2a_agents.endpoint_url, a2a_agents.agent_type, a2a_agents.protocol_version, a2a_agents.capabilities, a2a_agents.config, a2a_agents.auth_type, a2a_agents.auth_value, a2a_agents.enabled, a2a_agents.reachable, a2a_agents.created_at, a2a_agents.updated_at, a2a_agents.last_interaction, a2a_agents.tags, a2a_agents.created_by, a2a_agents.created_from_ip, a2a_agents.created_via, a2a_agents.created_user_agent, a2a_agents.modified_by, a2a_agents.modified_from_ip, a2a_agents.modified_via, a2a_agents.modified_user_agent, a2a_agents.import_batch_id, a2a_agents.federation_source, a2a_agents.version, a2a_agents.team_id, a2a_agents.owner_email, a2a_agents.visibility
FROM a2a_agents
WHERE a2a_agents.enabled IS 1 AND (a2a_agents.owner_email = ? OR a2a_agents.visibility = ?)
ORDER BY a2a_agents.created_at DESC
LIMIT ? OFFSET ?

parameters:
({'email': 'admin@admin.com', 'full_name': 'Platform Administrator', 'is_admin': True, ...}, 'public', 100, 0)

Observed invocation result in UI:

helloworld
Hello world A2A agent
Active
Reachable
customAuth: None
Endpoint: http://localhost:8083/agent
Executions: 0 | Success Rate: N/A
Created: 2026-05-06 10:16:35
❌ Test Failed
Error: HTTP 500:

🧠 Environment Info

Key Value
Version or commit 0.7.0
Runtime Python 3.12, Uvicorn
Platform / OS Not yet confirmed
Container Containerized deployment
Image Image Image

🧩 Additional Context (optional)

  • The A2A agent registration itself appears to succeed.
  • The primary blocker is that GET /a2a fails with 500, so I cannot obtain the agent_id needed for GET /a2a/{agent_id}.
  • From the stack trace, it looks like the request is passing a full authenticated user dict where the SQL query expects a scalar email string.
  • The relevant call appears to be:
return await a2a_service.list_agents_for_user(db, user_email=user, ...)

It may need to pass something like user["email"] instead of the entire user object.

  • There may also be a second issue affecting invocation, since the registered agent endpoint is currently shown as:
http://localhost:8083/agent

If the gateway/runtime is not on the same host/network namespace as that agent process, localhost may not be reachable from the MCP Gateway container/pod even if the agent is reachable in its own local environment.

  • I can attach screenshots for:
    1. Agent shown as active/running in IBM Context Forge
    2. Swagger /docs A2A endpoints
    3. UI test failure showing HTTP 500

Metadata

Metadata

Labels

MUSTP1: Non-negotiable, critical requirements without which the product is non-functional or unsafea2aSupport for A2A protocolapiREST API Related itembugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions