Skip to main content
Glama

Cancel a job (free)

codex_job_cancel
Idempotent

Cancel a running Codex job, gracefully shut down its worker, and remove the temporary worktree. Idempotent: retries are safe, and already-finished jobs are returned unchanged.

Instructions

Cancel a running background Codex job.

Asks the worker to shut down gracefully so it tears down its throwaway worktree, then force-kills it if it overstays, and marks the job cancelled (cancelled jobs cannot be resumed). If the worktree could not be removed, cleanup_warnings names the leftover path. Already-terminal jobs are returned unchanged, so cancel is idempotent — a retry after a lost response is safe. Free — no model call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_idYesThe job_id from an *_async call or a sync call's meta.job_id; recover lost ids with codex_job_list.
workspace_rootNoAbsolute path to the target repo root — pass it (or an MCP root) to target the intended repo; otherwise the call falls back to the server's own cwd and sets meta.workspace_warning.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
Behavior5/5

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

The description richly discloses behavior beyond the annotations: graceful shutdown, force-kill on overstay, teardown of the throwaway worktree, non-resumability of cancelled jobs, cleanup_warnings for leftover paths, idempotency, and 'Free — no model call'. These details add significant context that the annotations do not provide and do not contradict them.

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 compact paragraph of four sentences, each adding concrete value. It front-loads the purpose, then details the shutdown process, idempotency, and cost, with zero filler or repetition.

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?

For a cancellation tool with side effects, the description covers the full lifecycle: graceful shutdown, force-kill, worktree cleanup, non-resumability, idempotency, and cost, plus a mention of the output field cleanup_warnings. With an output schema available, this is a complete picture for an agent to decide and invoke confidently.

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?

The input schema already has 100% coverage with descriptions for both job_id and workspace_root. The description does not add any additional param-specific meaning beyond what the schema states, so it meets the baseline of 3.

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 starts with 'Cancel a running background Codex job', which is a specific verb (Cancel) and resource (Codex job) with scope (running background). This clearly distinguishes it from sibling tools like codex_job_status or codex_job_result, which check status or retrieve results.

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

Usage Guidelines4/5

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

It clearly states the tool is for cancelling running jobs and mentions that already-terminal jobs are returned unchanged, making retries safe. However, it does not explicitly name alternatives (e.g., 'use codex_job_status to check status instead'), so it falls just short of a full 5.

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/briandconnelly/codex-in-claude'

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