Skip to content

Use MCP server instructions in deferred namespace descriptions#21053

Merged
sayan-oai merged 2 commits into
mainfrom
codex-issue2-double-underscore
May 4, 2026
Merged

Use MCP server instructions in deferred namespace descriptions#21053
sayan-oai merged 2 commits into
mainfrom
codex-issue2-double-underscore

Conversation

@sayan-oai
Copy link
Copy Markdown
Collaborator

@sayan-oai sayan-oai commented May 4, 2026

Why

MCP servers can provide instructions that explain what their tools are for. Directly exposed MCP namespaces already use those instructions when a connector description is not available, but deferred tool_search results did not preserve that fallback. The direct path falls back from connector metadata to server instructions, while the deferred path only carried connector_description and otherwise fell back to generic namespace text.

That meant a plain MCP server could provide useful model-facing guidance and still appear as Tools in the X namespace. whenever it was discovered lazily through tool_search.

What changed

  • Store one model-facing namespace_description on ToolInfo, using connector descriptions for connector-backed tools and server instructions for plain MCP servers.
  • Thread that namespace description through the tool_search source list, search indexing, and returned namespace metadata.
  • Add an end-to-end regression test for deferred non-app MCP search results exposing server instructions as the namespace description.

Verification

  • cargo test -p codex-tools search_tool_description_lists_each_mcp_source_once --lib
  • cargo test -p codex-core --test all tool_search_uses_non_app_mcp_server_instructions_as_namespace_description

@sayan-oai sayan-oai requested a review from a team as a code owner May 4, 2026 18:15
@sayan-oai sayan-oai force-pushed the codex-issue2-double-underscore branch from 7b8475a to 7bc4811 Compare May 4, 2026 18:29
@sayan-oai sayan-oai force-pushed the codex-issue2-double-underscore branch from 7bc4811 to 32ff683 Compare May 4, 2026 18:36
Comment thread codex-rs/codex-mcp/src/tools.rs Outdated
}

pub fn namespace_description(&self) -> Option<&str> {
self.connector_description
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is connector_description used in any other interesting way? can we have one fied?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fair, i think we can

@sayan-oai sayan-oai enabled auto-merge (squash) May 4, 2026 19:32
@sayan-oai sayan-oai merged commit b9e8df4 into main May 4, 2026
37 of 38 checks passed
@sayan-oai sayan-oai deleted the codex-issue2-double-underscore branch May 4, 2026 19:36
@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants