Skip to main content
Glama

a2a_send_task

Send messages to A2A protocol agents for task execution, with optional task and agent ID assignment for tracking and routing.

Instructions

Send a task to an A2A agent

Input Schema

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

Implementation Reference

  • The handler function for the 'a2a_send_task' tool. It extracts parameters, selects an agent client, sends the task using client.sendTask, and returns the result as a formatted text response.
    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), }, ], }; }
  • The input schema definition for the 'a2a_send_task' tool, specifying the required 'message' and optional 'taskId' and 'agentId' parameters.
    { 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"], }, },
  • index.ts:31-131 (registration)
    Registration of available tools including 'a2a_send_task' via the ListToolsRequestSchema handler.
    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", }, }, }, }, ], }));

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