From 2cc614fea182cf0ef7b44dd49f09c0b1d9a89987 Mon Sep 17 00:00:00 2001 From: GuDaStudio Date: Thu, 13 Nov 2025 17:55:09 +0800 Subject: [PATCH] =?UTF-8?q?v0.6=EF=BC=9A=E6=94=AF=E6=8C=81=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/codexmcp/server.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/codexmcp/server.py b/src/codexmcp/server.py index 95b74b4..902922b 100644 --- a/src/codexmcp/server.py +++ b/src/codexmcp/server.py @@ -2,6 +2,7 @@ from __future__ import annotations +from ast import List import json import os import queue @@ -148,11 +149,38 @@ async def codex( bool, "Return all messages (e.g. reasoning, tool calls, etc.) from the codex session. Set to `False` by default, only the agent's final reply message is returned.", ] = False, + image: Annotated[ + Optional[List[Path]], + Field( + description="Attach one or more image files to the initial prompt. Separate multiple paths with commas or repeat the flag.", + ), + ] = None, + model: Annotated[ + Optional[str], + Field( + description="The model to use for the codex session. Default user configuration is applied; this parameter remains inactive unless explicitly specified by the user.", + ), + ] = None, + yolo: Annotated[ + Optional[bool], + Field( + description="Run every command without approvals or sandboxing. Only use when `sandbox` couldn't be applied.", + ), + ] = False, ) -> Dict[str, Any]: """Execute a Codex CLI session and return the results.""" # Build command as list to avoid injection cmd = ["codex", "exec", "--sandbox", sandbox, "--cd", str(cd), "--json"] + if image is not None: + cmd.extend(["--image", ",".join(image)]) + + if model is not None: + cmd.extend(["--model", model]) + + if yolo: + cmd.append("--yolo") + if skip_git_repo_check: cmd.append("--skip-git-repo-check")