[API]: Return the agent's tool id on A2AAgentRead
Summary A2AAgentRead omits tool_id (schemas.py:7148), so a client cannot tell which tool belongs to an agent. The client has to request GET /tools with limit=0 and match annotations.a2a_agent_id on each tool, because list_tools accepts no integration_type or a2a_agent_id filter. The virtual server builder needs the link: adding an agent to a virtual server writes server_tool_association, and list_server_tools reads only that table (tool_service.py:4984).
Return this column on A2AAgentRead: a2a_agents.tool_id is a foreign key to tools.id with ondelete SET NULL (db.py:5067), indexed at db.py:5083, and register_agent sets it after it creates the tool for the agent (a2a_service.py:1175).
Proposed changes
- Add tool_id to A2AAgentRead.
- Return null when the agent has no tool.
- Read the value from the existing column, without a query per agent in the list path.
Acceptance criteria
- [ ] GET /v1/a2a/{agent_id} returns tool_id.
- [ ] GET /v1/a2a returns tool_id for every agent.
- [ ] tool_id is null when the tool is missing or was deleted.
- [ ] Listing agents runs the number of queries it runs today.
Not included: a filter on GET /tools for integration_type or a2a_agent_id.
Related issues: #7024, #7023
May I implement this after you accept the scope and remove triage?
I propose exposing the existing tool_id column through A2AAgentRead. I will check:
- Single-agent and list responses.
- Null values for missing tools.
- An unchanged query count for agent lists.
I will wait for your confirmation before implementation.