Skip to main content
Glama

Delegate work to a new Codex session

delegate_to_codex
Destructive

Delegate a coding task to Codex by creating a session in the target directory, sending the prompt, and returning the reply while preserving thread history for review in Codex Desktop.

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.

Input Schema

TableJSON 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
openInAppNoShow the task in Codex Desktop; native tasks open immediately while running
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. 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)"
  2. 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"
  3. First observedv1.11.2

TDQS

A3.9/5.0
Behavior4/5

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

With annotations already covering destructiveHint/openWorldHint, the description adds genuine behavioral context: the operation returns Codex's reply, hands the session to Codex Desktop, and specifically avoids leaving the bridge writer lock behind. This discloses a side-effect and cleanup detail that annotations cannot convey. No contradiction with the annotations.

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?

One dense sentence with zero filler: every clause carries one phase of the operation, and the distinctive lock-cleanup behavior is placed last for emphasis without bloating the description.

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

Completeness3/5

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

For an 8-parameter destructive tool with no output schema, the description captures the main flow but omits the return shape; the timeoutSec parameter reveals that a threadId is returned on timeout, but the description only says 'return Codex's reply'. An agent knows what the tool does but not precisely what it gets back or how the desktop handoff interacts with the timeout case.

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 the baseline is 3, and the description only loosely reinforces cwd (project directory), name (named session), and prompt. It adds nothing about model, timeoutSec, or releaseAfterTurn beyond what the schema already documents.

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 precise verb chain (create session, send prompt, return reply, hand to Desktop) with a specific resource (a new Codex session at a project directory). This clearly differentiates it from send_to_codex_thread, which implies messaging an existing thread, without needing to open the schema.

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?

Usage is implied rather than stated: creating a fresh named session and handing it to Desktop suggests delegation of work to a new Codex context. However, the description never explicitly says when to choose this over sending to an existing thread, nor does it name alternatives or exclusions.

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