What tools are available in the CLI?

HEAD
f675bf9fix: file watcher (#12105)
This post might have stale content, as HEAD is 652 commits ahead.
Avatar of martinsione
Martin Sione
posted

which tools does the cli have available?

Avatar of anthropic/claude-haiku-4.5
Claude Haiku 4.5
commented

Perfect! Now I have a comprehensive view of the CLI. Let me compile this information into a complete answer.

##Summary

The Codex CLI has access to several categories of tools and commands:

###Main CLI Subcommands (via codex <command>):

  1. exec / e - Run Codex non-interactively with a prompt or various options

    • Can resume previous sessions
    • Can run code reviews (with review subcommand)
  2. login - Manage authentication

    • Sign in with ChatGPT
    • Sign in with API key
    • Device code authentication
    • Check login status
  3. logout - Remove stored authentication credentials

  4. mcp - Manage Model Context Protocol (MCP) servers (external tools)

    • list - List configured MCP servers
    • get - Show a single server
    • add - Add a server launcher entry
    • remove - Delete a server entry
    • login - Authenticate with MCP server via OAuth
    • logout - Remove OAuth credentials
  5. mcp-server - Start Codex as an MCP server (stdio)

  6. app-server - Run the app server or tooling (experimental)

  7. app (macOS only) - Launch the Codex desktop app

  8. completion - Generate shell completion scripts

  9. sandbox - Run commands within a Codex-provided sandbox

    • macos / seatbelt - Sandbox with Seatbelt (macOS)
    • linux / landlock - Sandbox with Landlock+seccomp (Linux)
    • windows - Sandbox with Windows restricted token
  10. debug - Debugging tools

  11. apply / a - Apply the latest diff as a git patch

  12. resume - Resume a previous interactive session

  13. fork - Fork a previous interactive session

  14. cloud / cloud-tasks - Browse and apply Codex Cloud tasks (experimental)

  15. features - Inspect feature flags

###Slash Commands (within interactive mode, type /):

  • /model - Choose model and reasoning effort
  • /approvals or /permissions - Configure what Codex is allowed to do
  • /setup-default-sandbox - Set up elevated agent sandbox
  • /sandbox-add-read-dir - Let sandbox read a directory
  • /experimental - Toggle experimental features
  • /skills - Use skills to improve performance on specific tasks
  • /review - Review current changes and find issues
  • /rename - Rename the current thread
  • /new - Start a new chat during a conversation
  • /resume - Resume a saved chat
  • /fork - Fork the current chat
  • /init - Create an AGENTS.md file with instructions
  • /compact - Summarize conversation to prevent context limit
  • /plan - Switch to Plan mode
  • /collab - Change collaboration mode (experimental)
  • /agent - Switch the active agent thread
  • /diff - Show git diff (including untracked files)
  • /mention - Mention a file
  • /status - Show current session configuration and token usage
  • /debug-config - Show config layers and requirement sources
  • /statusline - Configure status line items
  • /ps - List background terminals
  • /clean - Stop all background terminals
  • /mcp - List configured MCP tools
  • /apps - Manage apps
  • /logout - Log out of Codex
  • /quit or /exit - Exit Codex
  • /feedback - Send logs to maintainers
  • /personality - Choose a communication style

###MCP Servers (External Tools)

The most extensible tool system is MCP (Model Context Protocol), which allows you to integrate external tools and capabilities. You can configure these via codex mcp add or in your ~/.codex/config.toml. These servers provide additional capabilities to Codex that can range from file operations to custom integrations.

Avatar of martinsione
Martin Sione
commented

What tools does the agent have available?

Avatar of anthropic/claude-haiku-4.5
Claude Haiku 4.5
commented

Perfect! Now I have enough information. Let me compile a comprehensive summary of all the tools available to the agent:

##Answer

Based on the source code, the Codex agent has access to the following tools:

###Core Execution Tools

  1. exec_command - Runs a command in a PTY, returning output or a session ID for ongoing interaction. Supports parameters like cmd, workdir, shell, login, tty, yield_time_ms, max_output_tokens.

  2. write_stdin - Writes characters to an existing unified exec session and returns recent output. Used for interactive sessions.

  3. shell - Runs a shell command and returns its output. Takes command array, workdir, and timeout parameters.

  4. shell_command - Runs a shell command and returns output. Takes a command string, workdir, login flag, and timeout.

###File Operations Tools (some experimental)

  1. read_file - Reads a local file with 1-indexed line numbers, supporting slice and indentation-aware block modes to extract specific code sections.

  2. list_dir - Lists entries in a local directory with 1-indexed entry numbers and type labels. Supports pagination and depth control.

  3. grep_files - Finds files whose contents match a regex pattern and lists them by modification time. Returns file paths matching search criteria.

  4. apply_patch - Edits files using a custom patch format. Can create new files, delete files, or update existing files. Can be in freeform or JSON format depending on the model.

###Code Understanding & Planning Tools

  1. update_plan - Updates the task plan with step-by-step progress tracking. Each step can have status: pending, in_progress, or completed. Provides structured way to document work.

  2. view_image - Views a local image from the filesystem by filepath.

###Web Search & App Integration

  1. web_search - Enables live web search (when enabled). Can be cached or live external access depending on configuration.

  2. search_tool_bm25 - Searches apps/integrations using BM25 ranking. Query-based tool discovery.

###Collaboration & Multi-Agent Tools (when enabled)

  1. spawn_agent - Spawns a new agent thread for collaborative work.

  2. send_input - Sends input/prompts to another agent thread.

  3. resume_agent - Resumes a paused agent thread.

  4. wait - Waits for another agent thread with timeout support.

  5. close_agent - Closes/terminates an agent thread.

###JavaScript Execution (when enabled)

  1. js_repl - Runs JavaScript in a persistent Node kernel with top-level await. Freeform tool accepting raw JavaScript.

  2. js_repl_reset - Restarts the js_repl kernel and clears persisted bindings.

###User Interaction Tools (when enabled)

  1. request_user_input - Requests input from the user with various modes (text, choose-one, multiple-choice, etc.).

###MCP Resource Tools

  1. list_mcp_resources - Lists available resources from MCP servers.

  2. list_mcp_resource_templates - Lists resource templates available from MCP servers.

  3. read_mcp_resource - Reads a specific resource from an MCP server.

###External Tools (MCP)

  1. MCP-based tools - Any tools registered via the Model Context Protocol. These are dynamically added based on user configuration via codex mcp add. Examples could include calendar integrations, API clients, shell utilities, etc.

###Dynamic Tools

  1. Dynamic tools - Application-defined tools that can be injected based on the agent's needs.

###Tool Availability

The availability of tools depends on:

  • Feature flags - Some tools are gated behind feature toggles
  • Model capabilities - Different models support different tool types (freeform vs. function)
  • Configuration - Users can enable/disable tools via config.toml
  • MCP servers - External tools provided by configured MCP servers
  • Environment - Some tools may only work on specific platforms

The agent also has access to approval and sandboxing control for execution tools, allowing it to request elevated permissions or sandboxed execution based on the command being run.


END OF POST

What tools are available in the CLI? — openai/codex