From ee122db6f7b680cbedb8a6deb68d3a2fd8379548 Mon Sep 17 00:00:00 2001 From: saladday <1203511142@qq.com> Date: Sun, 18 Jan 2026 15:54:33 +0800 Subject: [PATCH] feat: add reasoning_effort parameter to control thinking budget Add support for model_reasoning_effort parameter to the codex MCP tool, allowing dynamic control over the reasoning depth for different task complexities. - Add reasoning_effort parameter with Literal type validation - Support values: low, medium, high, xhigh - Maps to codex CLI: --config model_reasoning_effort="" - Defaults to None (uses config/profile default) Closes #37 --- src/codexmcp/server.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/codexmcp/server.py b/src/codexmcp/server.py index 93a1ab5..bcf09d6 100644 --- a/src/codexmcp/server.py +++ b/src/codexmcp/server.py @@ -180,6 +180,16 @@ async def codex( description="The model to use for the codex session. This parameter is strictly prohibited unless explicitly specified by the user.", ), ] = "", + reasoning_effort: Annotated[ + Optional[Literal["low", "medium", "high", "xhigh"]], + Field( + description=( + "Override Codex config `model_reasoning_effort` (thinking budget). " + "Allowed values: low, medium, high, xhigh. " + "If omitted, uses the config/profile default." + ), + ), + ] = None, yolo: Annotated[ bool, Field( @@ -203,7 +213,10 @@ async def codex( if profile: cmd.extend(["--profile", profile]) - + + if reasoning_effort is not None: + cmd.extend(["--config", f'model_reasoning_effort="{reasoning_effort}"']) + if yolo: cmd.append("--yolo")