-
Notifications
You must be signed in to change notification settings - Fork 269
Description
🐞 Bug Summary
Created a sample A2A Agent. Will provide the code below.
-
A2A agent is exposed as an api endpoint and takes a user query. There is no way to test this A2A Agent from the UI, as no field to pass the user input.
-
Tools from the A2A Agent is not getting listed under the Global Tools Tab.
Sample A2A Agent code:
`
import random
def calculator(expression: str) -> str:
"""Evaluate a math expression safely."""
try:
result = eval(expression, {"__builtins__": {}})
return str(result)
except Exception as e:
return f"Error: {e}"
def weather(city: str) -> str:
"""Mock weather lookup tool."""
conditions = ["sunny", "rainy", "cloudy", "stormy"]
temp = random.randint(10, 35)
return f"The weather in {city} is {random.choice(conditions)}, {temp}°C"
`
from a2a_agent.tools import calculator, weather class SimpleAgent: def __init__(self, name="Agent"): self.name = name self.tools = { "calculator": calculator, "weather": weather, } def run(self, query: str) -> str: # Very basic routing if "calc:" in query: expr = query.replace("calc:", "").strip() return self.tools["calculator"](expr) elif "weather:" in query: city = query.replace("weather:", "").strip() return self.tools["weather"](city) else: return f"{self.name} does not understand the query."
from a2a_agent.agent import SimpleAgent def main(): agent = SimpleAgent("A2A-Agent") print("A2A Agent started. Try queries like:") print(" calc: 5*10+2") print(" weather: Dallas") while True: query = input("\n> ") if query.lower() in ["exit", "quit"]: break print(agent.run(query)) if __name__ == "__main__": main()
`from fastapi import FastAPI
from pydantic import BaseModel
from a2a_agent.agent import SimpleAgent
app = FastAPI(title="A2A Agent API")
agent = SimpleAgent("A2A-Agent")
class Query(BaseModel):
query: str
@app.post("/run")
def run_agent(req: Query):
response = agent.run(req.query)
return {"response": response}
`
uv run uvicorn a2a_agent.api:app --host 0.0.0.0 --port 8000
`curl -X POST "http://localhost:8000/run" \
-H "Content-Type: application/json" \
-d '{"query": "calc: 7*8"}'
curl -X POST "http://localhost:8000/run" \
-H "Content-Type: application/json" \
-d '{"query": "weather: Dallas"}'
`
`A2A Agent started. Try queries like:
calc: 5*10+2
weather: Dallas
calc: 7*9
63
weather: Houston
The weather in Houston is sunny, 28°C
`


🧩 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
- ...
- ...
- ...
🤔 Expected Behavior
What should have happened instead?
📓 Logs / Error Output
Paste any relevant stack traces or logs here.
🧠 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.