Skip to main content
Glama

Cancel A2A Task

a2a_cancel_task
DestructiveIdempotent

Stop an active agent task by providing its ID and agent card URL, transitioning its status to canceled. Use this to halt long-running or unwanted operations.

Instructions

Cancel a running A2A task.

This tool requests cancellation of an active task. The agent will attempt to gracefully stop the task execution and update its status to "canceled".

Args:

  • agentCardUrl (string): URL to the agent's card endpoint

  • taskId (string): The unique identifier of the task to cancel

Returns: JSON response confirming the cancellation request:

  • success: Boolean indicating if cancellation was initiated

  • message: Description of the cancellation result

  • task: Updated task object with "canceled" status (if available)

Note: Cancellation may not be immediate. The task status should transition to "canceled" once the agent completes the cancellation process.

Examples:

Error Handling:

  • Returns "Error: Task not found" if the task ID doesn't exist

  • Returns "Error: Task already completed" if the task is no longer running

  • Returns "Error: Cancellation not supported" if the agent doesn't support task cancellation

  • After cancellation, use a2a_get_task to verify the task status changed to "canceled"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe unique identifier of the task to cancel
agentCardUrlYesURL to the agent's card endpoint
Behavior5/5

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

Beyond the annotations, the description discloses important behavioral nuances: cancellation may not be immediate, the agent 'attempts' to stop gracefully, and task status transitions asynchronously. It also enumerates failure modes including 'Task not found', 'Task already completed', and 'Cancellation not supported'. No contradiction with annotations exists.

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 well structured with clear sections for Args, Returns, Examples, and Error Handling, and the main purpose is front-loaded. While it is longer than minimal, every section adds useful operational information rather than filler.

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

Completeness5/5

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

With no output schema, the description compensates by documenting the exact return shape, error responses, async cancellation behavior, and the follow-up verification tool. It is sufficiently complete for an agent to understand expected behavior, know what inputs to supply, and handle failures correctly.

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

Parameters4/5

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

The schema already covers both parameters at 100%, so the baseline is 3. The description adds value with concrete usage examples mapping natural-language requests to parameter values, and clarifies that taskId should identify the active task to cancel. It doesn't add much beyond the schema, but the examples and error context make it slightly stronger.

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

Purpose5/5

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

The description opens with 'Cancel a running A2A task' and clearly specifies the action, resource, and expected effect ('attempt to gracefully stop the task execution and update its status to canceled'). This distinguishes it from sibling tools like a2a_get_task, a2a_send_message, and a2a_get_agent_card, which all involve different actions.

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

Usage Guidelines5/5

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

The description provides explicit when-to-use examples ('Cancel the long-running task abc-123'), a don't-use-when exclusion ('Task has already completed'), and an explicit post-cancellation verification step ('use a2a_get_task to verify'). This gives an agent clear guidance for choosing and following up on this tool.

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/ericabouaf/a2a-mcp-server'

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