Skip to main content
Glama

a2a_send_task_subscribe

Send tasks to A2A-compatible agents and subscribe to real-time updates for task progress and responses through streaming. Customize with message, task ID, agent ID, and maximum updates.

Instructions

Send a task and subscribe to updates (streaming)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentIdNoOptional agent ID. If not provided, the first available agent will be used
maxUpdatesNoMaximum number of updates to receive (default: 10)
messageYesMessage to send to the agent
taskIdNoOptional task ID. If not provided, a new UUID will be generated

Implementation Reference

  • Handler for a2a_send_task_subscribe tool: gets client from agentManager, sends task with subscribe, collects up to maxUpdates from stream, returns taskId and updates.
    case "a2a_send_task_subscribe": { const { message, taskId, agentId, maxUpdates = 10 } = args as { message: string; taskId?: string; agentId?: string; maxUpdates?: number; }; const client = agentId ? agentManager.getClientById(agentId) : agentManager.getAllClients().values().next().value; if (!client) { throw new Error(`No available agent${agentId ? ` with ID ${agentId}` : ''}`); } const id = taskId || crypto.randomUUID(); const stream = client.sendTaskSubscribe({ id, message: { role: "user", parts: [{ text: message }], }, }); const updates = []; let count = 0; for await (const event of stream) { updates.push(event); count++; if (count >= maxUpdates) break; if (event.final) break; } return { content: [ { type: "text", text: JSON.stringify({ taskId: id, updates }, null, 2), }, ], }; }
  • Schema definition for the a2a_send_task_subscribe tool, listed in the ListTools response.
    { 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"], }, },
  • index.ts:31-131 (registration)
    Registration of all tools including a2a_send_task_subscribe via the ListToolsRequestHandler.
    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", }, }, }, }, ], }));

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