Skip to main content
Glama

a2a_send_task

Send tasks to A2A agents using this tool, facilitating message delivery and task tracking. Supports custom task IDs or auto-generates them, and routes tasks to specified or available agents.

Instructions

Send a task to an A2A agent

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentIdNoOptional agent ID. If not provided, the first available agent will be used
messageYesMessage to send to the agent
taskIdNoOptional task ID. If not provided, a new UUID will be generated

Implementation Reference

  • index.ts:33-54 (registration)
    Registration of the a2a_send_task tool in the MCP server's listTools handler, including name, description, and input schema definition.
    { 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"], }, },
  • Handler logic for executing the a2a_send_task tool: parses arguments, selects A2A client, calls sendTask, returns result as text content.
    case "a2a_send_task": { const { message, taskId, agentId } = args as { message: string; taskId?: string; agentId?: string }; const client = agentId ? agentManager.getClientById(agentId) : agentManager.getAllClients().values().next().value; if (!client) { throw new Error(`No available agent${agentId ? ` with ID ${agentId}` : ''}`); } const result = await client.sendTask({ id: taskId || crypto.randomUUID(), message: { role: "user", parts: [{ text: message }], }, }); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • Core helper method in A2AClient that implements the task sending by making a JSON-RPC POST request to the A2A agent's 'tasks/send' endpoint.
    async sendTask(params: TaskSendParams): Promise<Task | null> { const httpResponse = await this._makeHttpRequest("tasks/send", params); return this._handleJsonResponse<Task | null>(httpResponse, "tasks/send"); }
  • AgentManager method to retrieve the A2AClient instance by agent ID, used in the tool handler.
    getClientById(id: string): A2AClient | undefined { return this.clients.get(id); }

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