Skip to content

[codex-apps] Filter optional file fields by tool schema#31686

Open
tsarlandie-oai wants to merge 2 commits into
mainfrom
tsarlandie/file-param-schema-projection
Open

[codex-apps] Filter optional file fields by tool schema#31686
tsarlandie-oai wants to merge 2 commits into
mainfrom
tsarlandie/file-param-schema-projection

Conversation

@tsarlandie-oai

@tsarlandie-oai tsarlandie-oai commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Codex Apps file parameters are exposed to the model as local paths, uploaded at execution time, and rewritten into provided-file payloads before the MCP tool call.

The rewrite currently includes the documented optional fields mime_type and file_name for every file parameter. Apps with strict schemas can reject those fields when they are not declared.

Changes

  • Derive the supported optional file fields from each openai/fileParams parameter's raw input schema before replacing it with the model-visible local-path schema.
  • Always include download_url and file_id.
  • Include mime_type and file_name only when that specific file parameter's schema accepts them, including schemas that allow additional properties.
  • Handle scalar and array file parameters, including items-only arrays, composed schemas, and local JSON Schema references.
  • Preserve the existing restriction that only the host-owned Codex Apps MCP server can use this upload path.

This supports tools with different file contracts in the same app: one parameter can accept the optional fields while another remains strict.

Validation

  • just test -p codex-mcp
  • just test -p codex-core mcp_openai_file
  • just test -p codex-core codex_apps_file_params_
  • just fix -p codex-mcp
  • just fix -p codex-core
  • just fmt
  • git diff --check
  • Manually verified in the Codex Electron app that:
    • a strict file schema receives only download_url and file_id
    • a rich file schema also receives mime_type and file_name

Related: #31330

@tsarlandie-oai tsarlandie-oai requested a review from a team as a code owner July 9, 2026 01:45
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b32fb3fd3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/codex-mcp/src/tools.rs Outdated
Comment thread codex-rs/codex-mcp/src/tools.rs Outdated
@tsarlandie-oai

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant