Skip to content

Fix empty tool descriptions#17946

Merged
sayan-oai merged 3 commits intomainfrom
shijie/fix-empty-tool-descriptions
Apr 15, 2026
Merged

Fix empty tool descriptions#17946
sayan-oai merged 3 commits intomainfrom
shijie/fix-empty-tool-descriptions

Conversation

@shijie-oai
Copy link
Copy Markdown
Collaborator

@shijie-oai shijie-oai commented Apr 15, 2026

Summary

  • Ensure direct namespaced MCP tool groups are emitted with a non-empty namespace description even when namespace metadata is missing or blank.
  • Add regression coverage for missing MCP namespace descriptions.

Cause

Latest main can serialize a direct namespaced MCP tool group with an empty top-level description. The namespace description path used unwrap_or_default() when tool_namespaces did not include metadata for that namespace, so the outbound Responses API payload could contain a tool like {"type":"namespace","description":""}. The Responses API rejects that because namespace tool descriptions must be a non-empty string.

Fix

  • Add a fallback namespace description: Tools in the <namespace> namespace.
  • Preserve provided namespace descriptions after trimming, but treat blank descriptions as missing.

Issue I am seeing

This is what I am seeing on the local build.
Screenshot 2026-04-15 at 10 55 55 AM

Comment thread codex-rs/tools/src/responses_api.rs Outdated

let description = description.trim();
let description = if description.is_empty() {
format!("Call the {name} tool.")
Copy link
Copy Markdown
Collaborator Author

@shijie-oai shijie-oai Apr 15, 2026

Choose a reason for hiding this comment

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

I am not really sure what we should do if there is a missing description but it does not like empty string here for sure. Not opposed just to put the name of the tool in here instead but I think the current approach is fine.

@shijie-oai shijie-oai marked this pull request as ready for review April 15, 2026 15:25
@shijie-oai shijie-oai requested review from jif-oai and sayan-oai April 15, 2026 15:25
@sayan-oai sayan-oai force-pushed the shijie/fix-empty-tool-descriptions branch from 27e1015 to 0c48d19 Compare April 15, 2026 16:29
@sayan-oai sayan-oai enabled auto-merge (squash) April 15, 2026 18:06
@sayan-oai sayan-oai merged commit 78ce61c into main Apr 15, 2026
43 of 47 checks passed
@sayan-oai sayan-oai deleted the shijie/fix-empty-tool-descriptions branch April 15, 2026 18:14
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 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.

3 participants