Skip to main content
Glama

gateway.tasks_cancel

Cancel a downstream MCP task by its opaque task ID, limited to tasks PMCP has recorded; already-finished tasks are reported without a downstream call.

Instructions

Cancel a downstream MCP task by opaque task ID. Only a task PMCP has recorded (from gateway.invoke with task, gateway.tasks_list, gateway.tasks_get or gateway.tasks_result) can be cancelled; an already-finished task is reported without a downstream call. Use gateway.cancel only for PMCP request IDs from gateway.list_pending.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "server_name": "<server_name>",
      "task_id": "<task_id>"
    },
    "name": "gateway.tasks_cancel"
  }
}

Input Schema

NameRequiredDescriptionDefault
forceNoPassed as force in the downstream tasks/cancel request; PMCP applies no health check of its own
task_idYesOpaque downstream task ID
server_nameYesServer that owns the task
requestor_contextNoOpaque requestor context forwarded downstream

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv3.0.1
    • addedInput schema / properties / force / description
      Added value: +"Passed as force in the downstream tasks/cancel request; PMCP applies no health check of its own"
    • addedInput schema / properties / requestor_context
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "Opaque requestor context forwarded downstream"
      +}
    • addedInput schema / properties / server_name / description
      Added value: +"Server that owns the task"
    • addedInput schema / properties / server_name / minLength
      Added value: +1
    • addedInput schema / properties / task_id / description
      Added value: +"Opaque downstream task ID"
    • addedInput schema / properties / task_id / minLength
      Added value: +1
  2. First observedv1.18.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose meaningful behavior: it is a downstream mutation, already-finished tasks are reported without a downstream call, and unrecorded tasks cannot be cancelled at all. It stops short of saying what happens on downstream failure, whether cancellation is guaranteed, or whether a force cancel can leave the task in an indeterminate state.

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?

Two sentences, no filler, and the precondition plus the sibling disambiguation are front-loaded. Every clause adds decision-relevant information.

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

Completeness4/5

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

For a four-parameter mutation with no annotations and no output schema, the description covers purpose, preconditions, the already-finished case, and the competing sibling. The remaining gap is return-shape detail — what 'reported without a downstream call' actually returns — which an agent would need in the absence of an output schema.

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 coverage is 100%, so all four parameters are already documented, including the force parameter's no-health-check semantics. The description adds provenance context for task_id (must be a PMCP-recorded task) but nothing about server_name or requestor_context beyond what the schema states. Baseline 3 is appropriate when the schema does the heavy lifting.

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?

States a specific verb and resource ('Cancel a downstream MCP task') plus the addressing key ('opaque task ID'). It explicitly separates itself from the sibling gateway.cancel by scope (downstream tasks vs. PMCP request IDs), so an agent can pick between them without opening either schema.

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?

Gives an explicit precondition (only tasks PMCP has recorded, enumerated via gateway.invoke with task, tasks_list, tasks_get, tasks_result) and an explicit alternative with its own scope (gateway.cancel for PMCP request IDs from gateway.list_pending). It also covers the edge case where the task is already finished, which tells the agent this call is safe to attempt.

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