Skip to content

AI Tools

CodexA implements a structured AI Agent Tooling Protocol — a typed request/response system that enables AI coding assistants to invoke CodexA tools via CLI, HTTP, or MCP.

Available Tools

ToolDescription
semantic_searchNatural language code search with ranked results
explain_symbolStructural explanation of a function, class, or method
explain_fileExplain all symbols in a source file
summarize_repoStructured summary of the entire repository
find_referencesFind all references to a symbol across the codebase
get_dependenciesImport/dependency map for a file
get_call_graphCallers and callees of a function
get_contextRich context window for AI-assisted tasks

Invocation Methods

CLI

bash
codex tool list                                            # List tools
codex tool run semantic_search --arg query="auth" --json   # Run a tool
codex tool schema semantic_search                          # View schema

HTTP Bridge

bash
# Start the bridge server
codex serve --port 24842

# Invoke a tool
curl -X POST http://127.0.0.1:24842/tools/invoke \
  -H "Content-Type: application/json" \
  -d '{"tool_name": "semantic_search", "arguments": {"query": "auth"}}'

# List tools
curl http://127.0.0.1:24842/tools/list

# SSE event stream
curl http://127.0.0.1:24842/tools/stream

MCP (Model Context Protocol)

bash
codex mcp --path /your/project

All 8 tools are exposed as MCP tools with proper schemas.

Protocol Dataclasses

ToolInvocation

FieldTypeDescription
tool_namestrName of the tool to invoke
argumentsdictKey-value arguments
request_idstrCorrelation ID (auto-generated)
timestampfloatUnix timestamp

ToolExecutionResult

FieldTypeDescription
tool_namestrTool that was executed
request_idstrCorrelation ID
successboolWhether execution succeeded
result_payloaddictOutput data (success only)
errorToolErrorError details (failure only)
execution_time_msfloatExecution time in milliseconds

ToolError

CodeMeaning
unknown_toolTool name not recognized
invalid_argumentsArgument validation failed
missing_required_argRequired argument not provided
execution_errorRuntime error during execution
timeoutExecution timed out
permission_deniedPermission denied

AI Workflows

Multi-Turn Chat

Persistent conversations about your codebase:

bash
codex chat "How does auth work?"
codex chat --session my-session "Follow up question"
codex chat --list-sessions

Sessions are stored in .codex/sessions/ with full message history.

Autonomous Investigation

Multi-step autonomous code exploration:

bash
codex investigate "Find all security vulnerabilities"
codex investigate "How is the payment flow implemented?" --max-steps 10

The investigation loop:

  1. LLM planner receives the question
  2. Decides an action: search, analyze, deps, or conclude
  3. Action is executed, results fed back to the planner
  4. Repeats until conclusion or step limit

Cross-Repo Refactoring

Find duplicate logic across workspace repos:

bash
codex cross-refactor --threshold 0.70

Streaming Responses

All LLM-powered commands support streaming:

bash
codex chat --stream "Explain the auth flow"
codex investigate --stream "Find performance issues"
ProviderStreaming
OpenAINative streaming API
OllamaNative HTTP streaming
MockWord-by-word simulation

Safety

  • All tools are read-only — no code execution or modification
  • Arguments are validated against declared schemas
  • Plugin tools cannot overwrite built-in tool names
  • Error codes are typed for reliable machine parsing

Plugin Integration

Register custom tools via the REGISTER_TOOL hook:

python
def on_hook(self, hook, data):
    if hook == PluginHook.REGISTER_TOOL:
        data["tools"].append({
            "name": "my_tool",
            "description": "My custom tool",
            "parameters": {"input": {"type": "string", "required": True}},
            "handler": my_handler_function,
        })
    return data

Additional hooks: PRE_TOOL_INVOKE, POST_TOOL_INVOKE, PRE_AI, POST_AI, ON_STREAM.

Released under the MIT License.