-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
Problem
Currently, the codex MCP tool only supports specifying the model parameter, but doesn't allow controlling the model_reasoning_effort configuration. This means all tasks use the same thinking budget defined in ~/.codex/config.toml, which is suboptimal for different task complexities.
Use Case
Different tasks require different levels of reasoning:
- Simple tasks (e.g., "add a print statement", "fix typo"):
lowormediumreasoning effort is sufficient and faster - Complex tasks (e.g., "refactor architecture", "debug race condition"):
highorxhighreasoning effort provides better quality
Currently, users must either:
- Manually edit
~/.codex/config.tomlbefore each task (cumbersome) - Create multiple profiles (requires pre-configuration and doesn't scale)
- Accept suboptimal performance (waste time on simple tasks or get poor results on complex ones)
Proposed Solution
Add a reasoning_effort parameter to the codex tool that maps to Codex CLI's -c model_reasoning_effort="..." option:
@mcp.tool()
async def codex(
PROMPT: Annotated[str, "Task instruction"],
cd: Annotated[Path, "Workspace root directory"],
# ... existing parameters ...
reasoning_effort: Annotated[
Optional[str],
"Reasoning effort level: 'low', 'medium', 'high', 'xhigh'. Controls thinking budget for the task."
] = None,
) -> dict:
# ...
if reasoning_effort:
cmd.extend(["-c", f'model_reasoning_effort="{reasoning_effort}"'])Example Usage
# Quick fix - use low reasoning
mcp.call_tool("codex", {
"PROMPT": "Add error logging to line 42",
"cd": "/path/to/project",
"reasoning_effort": "low"
})
# Complex refactoring - use xhigh reasoning
mcp.call_tool("codex", {
"PROMPT": "Refactor the authentication system to support OAuth2",
"cd": "/path/to/project",
"reasoning_effort": "xhigh"
})Benefits
- Performance: Faster responses for simple tasks
- Quality: Better results for complex tasks
- Cost efficiency: Avoid unnecessary compute on trivial operations
- Flexibility: Claude Code can dynamically adjust reasoning budget based on task complexity
Additional Context
The Codex CLI already supports this via -c model_reasoning_effort="...". This feature request simply exposes that capability through the MCP interface, similar to how the model parameter is already exposed.
Metadata
Metadata
Assignees
Labels
No labels