Skip to main content
Glama

a2a_agent_info

Retrieve detailed information about connected A2A agents, including specific agents by ID, to monitor and manage interactions within the A2A Client MCP Server.

Instructions

Get information about the connected A2A agents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentIdNoOptional agent ID. If not provided, information for all agents will be returned

Implementation Reference

  • Handler function for the 'a2a_agent_info' tool. Retrieves and returns agent card information for specified or all connected agents.
    case "a2a_agent_info": { const { agentId } = args as { agentId?: string }; if (agentId) { const client = agentManager.getClientById(agentId); if (!client) { throw new Error(`No agent found with ID ${agentId}`); } const card = await client.agentCard(); return { content: [ { type: "text", text: JSON.stringify(card, null, 2), }, ], }; } else { const results = []; for (const [id, client] of agentManager.getAllClients()) { try { const card = await client.agentCard(); results.push({ agentId: id, card }); } catch (error) { results.push({ agentId: id, error: error instanceof Error ? error.message : String(error) }); } } return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], }; } }
  • Schema definition for the 'a2a_agent_info' tool, including input schema.
    { name: "a2a_agent_info", description: "Get information about the connected A2A agents", inputSchema: { type: "object", properties: { agentId: { type: "string", description: "Optional agent ID. If not provided, information for all agents will be returned", }, }, }, },
  • index.ts:31-131 (registration)
    The tool is registered by being included in the ListToolsRequestHandler response.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: "a2a_send_task", description: "Send a task to an A2A agent", inputSchema: { type: "object", properties: { message: { type: "string", description: "Message to send to the agent", }, taskId: { type: "string", description: "Optional task ID. If not provided, a new UUID will be generated", }, agentId: { type: "string", description: "Optional agent ID. If not provided, the first available agent will be used", }, }, required: ["message"], }, }, { name: "a2a_get_task", description: "Get the current state of a task", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "ID of the task to retrieve", }, agentId: { type: "string", description: "ID of the agent that handled the task", }, }, required: ["taskId", "agentId"], }, }, { name: "a2a_cancel_task", description: "Cancel a running task", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "ID of the task to cancel", }, agentId: { type: "string", description: "ID of the agent that is handling the task", }, }, required: ["taskId", "agentId"], }, }, { name: "a2a_send_task_subscribe", description: "Send a task and subscribe to updates (streaming)", inputSchema: { type: "object", properties: { message: { type: "string", description: "Message to send to the agent", }, taskId: { type: "string", description: "Optional task ID. If not provided, a new UUID will be generated", }, agentId: { type: "string", description: "Optional agent ID. If not provided, the first available agent will be used", }, maxUpdates: { type: "number", description: "Maximum number of updates to receive (default: 10)", }, }, required: ["message"], }, }, { name: "a2a_agent_info", description: "Get information about the connected A2A agents", inputSchema: { type: "object", properties: { agentId: { type: "string", description: "Optional agent ID. If not provided, information for all agents will be returned", }, }, }, }, ], }));
  • The agentCard method in A2AClient class, which fetches the agent card from the A2A server endpoint. This is called by the tool handler.
    async agentCard(): Promise<AgentCard> { try { // First try the well-known endpoint try { const response = await fetch(`${this.baseUrl}/.well-known/agent.json`); if (response.ok) { return response.json(); } } catch (e) { // Ignore and try the next approach } // Then try the traditional endpoint const cardUrl = `${this.baseUrl}/agent-card`; const response = await fetch(cardUrl, { method: "GET", headers: { Accept: "application/json", }, }); if (!response.ok) { throw new Error( `HTTP error ${response.status} fetching agent card from ${cardUrl}: ${response.statusText}` ); } return response.json(); } catch (error) { console.error("Failed to fetch or parse agent card:", error); throw new Error( `Could not retrieve agent card: ${ error instanceof Error ? error.message : String(error) }` ); } }
  • TypeScript interface defining the structure of the AgentCard, which is the output type of the tool.
    export interface AgentCard { name: string; description?: string | null; url: string; provider?: AgentProvider | null; version: string; documentationUrl?: string | null; capabilities: AgentCapabilities; authentication?: AgentAuthentication | null; defaultInputModes?: string[]; defaultOutputModes?: string[]; skills: AgentSkill[]; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tesla0225/mcp-a2a'

If you have feedback or need assistance with the MCP directory API, please join our Discord server