Skip to main content
Glama
tesla0225

A2A Client MCP Server

by tesla0225

a2a_send_task_subscribe

Send a task to an A2A agent and subscribe to receive real-time streaming updates on its progress and responses.

Instructions

Send a task and subscribe to updates (streaming)

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
maxUpdatesNoMaximum number of updates to receive (default: 10)

Implementation Reference

  • Handler for the 'a2a_send_task_subscribe' MCP tool. Selects an A2A client, sends a task with subscription for streaming updates, collects up to maxUpdates events, and returns the task ID and updates as JSON.
    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),
          },
        ],
      };
    }
  • Input schema for the a2a_send_task_subscribe tool, validating message (required string), optional taskId, agentId, and maxUpdates (number).
    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:91-116 (registration)
    Registration of the a2a_send_task_subscribe tool in the ListToolsRequestSchema response, including name, description, and input schema.
    {
      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"],
      },
    },
  • Supporting utility method A2AClient.sendTaskSubscribe that initiates the streaming JSON-RPC request to 'tasks/sendSubscribe' for real-time task updates.
    sendTaskSubscribe(
      params: TaskSendParams
    ): AsyncIterable<TaskStatusUpdateEvent | TaskArtifactUpdateEvent> {
      const streamGenerator = async function* (
        this: A2AClient
      ): AsyncIterable<TaskStatusUpdateEvent | TaskArtifactUpdateEvent> {
        const httpResponse = await this._makeHttpRequest(
          "tasks/sendSubscribe",
          params,
          "text/event-stream"
        );
        yield* this._handleStreamingResponse<TaskStatusUpdateEvent | TaskArtifactUpdateEvent>(
          httpResponse,
          "tasks/sendSubscribe"
        );
      }.bind(this)();
    
      return streamGenerator;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the streaming behavior, which is a key trait, but lacks details on permissions, rate limits, error handling, or what 'updates' entail (e.g., format, frequency). For a tool with mutation ('send') and streaming, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and key feature (streaming). There is no wasted text, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation + streaming) and lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., stream format, success indicators) or provide sufficient behavioral details, leaving gaps for an AI agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 4 parameters. The description adds no parameter-specific information beyond what's in the schema, such as examples or usage tips. Baseline 3 is appropriate when the schema handles all parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Send a task and subscribe to updates') and specifies the streaming nature, which distinguishes it from the sibling 'a2a_send_task'. However, it doesn't explicitly mention what resource (e.g., agent, task system) is involved, leaving some ambiguity about the context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'subscribe to updates (streaming)', suggesting it's for real-time monitoring, but it doesn't explicitly state when to use this tool versus alternatives like 'a2a_send_task' (which likely doesn't stream) or 'a2a_get_task' (which might fetch static results). No exclusions or prerequisites are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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