Skip to main content
Glama

codex

Send tasks to an autonomous agent that handles complex software engineering work, including file operations, shell commands, codebase searches, and end-to-end project execution.

Instructions

Send a task to an autonomous Codex agent. It reads/writes files, runs shell commands, searches codebases, and handles complex software engineering tasks end-to-end. Returns the result text plus a thread_id for follow-ups via codex_reply.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesTask or question for Codex
cwdNoWorking directory (overrides CODEX_CWD)
modelNoModel override (e.g. "gpt-5-codex", "o3", "codex-1")
additionalDirsNoExtra directories the agent can access for this invocation
effortNoReasoning effort override
sandboxModeNoSandbox mode override (can only tighten, never loosen)
approvalPolicyNoApproval policy override (can only tighten, never loosen)
networkAccessNoEnable network access from sandbox
webSearchModeNoWeb search mode
instructionsNoAdditional instructions (prepended to prompt)

Implementation Reference

  • The tool named "codex" (by default) is registered here. The tool handler calls `runQuery`, which uses the `Codex` SDK to manage the interaction.
    server.registerTool(toolName, {
      description: toolDescription,
      inputSchema: z.object({
        prompt: z.string().describe("Task or question for Codex"),
        cwd: z.string().optional().describe("Working directory (overrides CODEX_CWD)"),
        model: z.string().optional().describe('Model override (e.g. "gpt-5-codex", "o3", "codex-1")'),
        additionalDirs: z.array(z.string()).optional().describe("Extra directories the agent can access for this invocation"),
        effort: z.enum(["minimal", "low", "medium", "high", "xhigh"]).optional().describe("Reasoning effort override"),
        sandboxMode: z.enum(["read-only", "workspace-write"]).optional().describe("Sandbox mode override (can only tighten, never loosen)"),
        approvalPolicy: z.enum(["on-failure", "on-request", "untrusted"]).optional().describe("Approval policy override (can only tighten, never loosen)"),
        networkAccess: z.boolean().optional().describe("Enable network access from sandbox"),
        webSearchMode: z.enum(["disabled", "cached", "live"]).optional().describe("Web search mode"),
        instructions: z.string().optional().describe("Additional instructions (prepended to prompt)"),
      }),
    }, async ({ prompt, cwd, model, additionalDirs, effort, sandboxMode, approvalPolicy, networkAccess, webSearchMode, instructions }) => {
      try {
        const result = await runQuery(prompt, {
          cwd, model, additionalDirs, effort, sandboxMode, approvalPolicy, networkAccess, webSearchMode, instructions,
        }, baseConfig, apiKey);
        return formatResult(result);
      } catch (error) {
        return formatError(error);
      }
    });
Behavior4/5

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

Strong given no annotations: Explicitly discloses destructive capabilities ('reads/writes files', 'runs shell commands') and return format ('result text plus thread_id'). Would benefit from mention of execution duration, error handling, or sandbox safety implications beyond the parameter hints.

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?

Perfect: Three sentences with zero waste. Front-loaded with core action ('Send a task'), middle sentence lists capabilities, final sentence covers return value and sibling relationship. Every sentence earns its place.

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?

Adequate for complexity: With 10 parameters and 100% schema coverage, the description appropriately compensates for missing output schema by documenting return values (thread_id, result text). Mentions sibling relationship which is crucial. Minor gap: could clarify synchronous vs asynchronous behavior or lifecycle for such an autonomous agent.

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?

Baseline score: With 100% schema description coverage, the description doesn't need to repeat parameter details. It adds context about the 'prompt' (task/question nature) implicitly through the agent description, but doesn't elaborate on specific parameters like 'approvalPolicy' or 'sandboxMode' semantics beyond the schema enums.

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?

Excellent: 'Send a task to an autonomous Codex agent' provides specific verb+resource. Capabilities list ('reads/writes files, runs shell commands...') clearly scopes functionality. Explicitly distinguishes from sibling 'codex_reply' by noting this tool initiates tasks while the sibling handles follow-ups.

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?

Good: Establishes workflow relationship with sibling by stating returns include 'thread_id for follow-ups via codex_reply'. However, lacks explicit guidance on when NOT to use this vs alternatives or prerequisites (e.g., when to use codex_reply directly instead).

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/xiaolai/codex-octopus'

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