Skip to main content
Glama

Delegate work to a new Codex session

delegate_to_codex
Destructive

Starts a named Codex session in a project directory, sends a prompt, returns the reply, and hands the task to Codex Desktop for authorized independent work.

Instructions

Create a named Codex session at the requested project directory, send Claude's prompt into it, return Codex's reply, and hand the session to Codex Desktop without leaving the bridge writer lock behind. Use for independent new work when the user explicitly or through standing instructions authorizes new conversations. Desktop creation returns a durable deliveryId; on timeout continue with wait_codex_reply instead of resending. In Desktop mode, supply a fresh requestId per independent task and keep it on retries; omit requestId in legacy app-server mode. Use send_to_codex_thread for unfinished work.

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": {
      "cwd": "<cwd>",
      "prompt": "<prompt>"
    },
    "name": "delegate_to_codex"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdYesAbsolute project directory where Codex must work
nameNoOptional Codex session title; otherwise one is derived from the prompt
modelNoModel override, e.g. gpt-5.6-luna
effortNoOverride reasoning effort (default whatever ~/.codex/config.toml says)
promptYesThe complete task Claude is delegating to Codex. The prompt for the recipient agent, with an explicit From Codex or From Claude header naming the actual author, all agent-authored text in English including the header purpose, and the sections Goal, Context, Task, Scope, Constraints, Done when, Reply format (omit any that do not apply); text the user supplied is sent verbatim
openInAppNoExplicitly show the task in Codex Desktop while it runs. Default is false unless CODEX_BRIDGE_OPEN_IN_APP=1; normal delivery does not navigate or focus a window.
requestIdNoDesktop creation identity: fresh UUID for each independent new task; retain exactly on retries. Omitting it preserves legacy title/prompt deduplication and can return an older task. Not supported in legacy app-server mode.
timeoutSecNoHow long to observe the task (Desktop caps the entire call, including creation, at 40s; the task continues and its threadId is returned)
releaseAfterTurnNoUnsubscribe this thread after a terminal turn; open Desktop only after its unload is confirmed

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.26.3
    • changedInput schema / properties / openInApp / description
      Previous value: -"Show the task in Codex Desktop; native tasks open immediately while running"New value: +"Explicitly show the task in Codex Desktop while it runs. Default is false unless CODEX_BRIDGE_OPEN_IN_APP=1; normal delivery does not navigate or focus a window."
  2. Changed2 schema fields changedv1.23.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / requestId / pattern
      Added value: +"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
  3. Changed1 schema field changedv1.22.2
    • changedInput schema / properties / prompt / description
      Previous value: -"The complete task Claude is delegating to Codex. The prompt for the recipient agent, in English with the sections Goal, Context, Task, Scope, Constraints, Done when, Reply format (omit any that do not apply); text the user supplied is sent verbatim"New value: +"The complete task Claude is delegating to Codex. The prompt for the recipient agent, with an explicit From Codex or From Claude header naming the actual author, all agent-authored text in English including the header purpose, and the sections Goal, Context, Task, Scope, Constraints, Done when, Reply format (omit any that do not apply); text the user supplied is sent verbatim"
  4. Changed1 schema field changedv1.19.3
    • addedInput schema / properties / requestId
      Added value: +{
      +  "description": "Desktop creation identity: fresh UUID for each independent new task; retain exactly on retries. Omitting it preserves legacy title/prompt deduplication and can return an older task. Not supported in legacy app-server mode.",
      +  "format": "uuid",
      +  "type": "string"
      +}
  5. Changed1 schema field changedv1.18.0
    • changedInput schema / properties / prompt / description
      Previous value: -"The complete task Claude is delegating to Codex"New value: +"The complete task Claude is delegating to Codex. The prompt for the recipient agent, in English with the sections Goal, Context, Task, Scope, Constraints, Done when, Reply format (omit any that do not apply); text the user supplied is sent verbatim"
  6. Changed2 schema fields changed
    • changedInput schema / properties / openInApp / description
      Previous value: -"Open the finished session in Codex Desktop on Windows or macOS"New value: +"Show the task in Codex Desktop; native tasks open immediately while running"
    • changedInput schema / properties / timeoutSec / description
      Previous value: -"How long to wait for the turn to finish (default 240s)"New value: +"How long to observe the task (Desktop caps the entire call, including creation, at 40s; the task continues and its threadId is returned)"
  7. Changed1 schema field changedv1.12.3
    • changedInput schema / properties / releaseAfterTurn / description
      Previous value: -"Stop the bridge app-server after a terminal turn so Codex Desktop owns the writer lock"New value: +"Unsubscribe this thread after a terminal turn; open Desktop only after its unload is confirmed"
  8. First observedv1.11.2

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructive/non-idempotent/open-world, and the description adds genuinely new behavioral facts: the bridge writer lock is released, Desktop creation yields a durable deliveryId, timeout means continue rather than resend, and the 40s Desktop cap lets the task keep running. This is exactly the beyond-annotation context the dimension rewards.

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

Conciseness4/5

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

Front-loaded with the full operation sequence, then the mode-specific rules, then the sibling pointer. Dense but each clause carries operational information; a few phrases (e.g. the lock-release detail) sit awkwardly mid-sentence, slightly impeding scanability.

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 9 parameters, no output schema, and a mode split (Desktop vs legacy app-server), the description covers what comes back (Codex's reply, deliveryId, threadId) and how to proceed on timeout. Nothing an agent needs before calling it is missing.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds real semantics for requestId (fresh UUID per independent task, retained on retries, omitted in legacy app-server mode) and for timeout/resend behavior that the schema property text alone frames more narrowly. It stops short of explaining cwd/name/model choices, so not a 5.

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 names a concrete verb chain (create session, send prompt, return reply, hand off to Desktop) on a specific resource, and explicitly contrasts itself with send_to_codex_thread for 'unfinished work'. An agent can distinguish this from start_codex_thread or send_to_worker without opening any 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?

It states when to use it ('independent new work when the user explicitly or through standing instructions authorizes new conversations') and names two alternatives with their triggering conditions: wait_codex_reply on Desktop timeout, and send_to_codex_thread for unfinished work. Exclusions are explicit rather than implied.

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