mirror of
https://github.com/openai/codex.git
synced 2026-11-08 00:36:31 +00:00
Support per-tool MCP output limits (#41421)
## What changed - Add a positive `output_token_limit` setting to each entry under an MCP server's `tools` configuration. - Apply the most restrictive limit when plugin and user policies overlap, while keeping approval policy independent. - Carry the effective MCP output budget in conversation history so tool output, post-tool hook responses, and resumed sessions use the same truncation limit. ## Testing - Cover configuration parsing, serialization, schema validation, and plugin policy merging. - Cover MCP output below and above the configured limit, post-tool hook responses, and session resume. GitOrigin-RevId: d0beb4fca9ba6055d9e1d31c137373b465d50d61
This commit is contained in:
1 parent
03147407e3
commit
f742dabc6f
38 files changed
+487
-224
No files matched your search
@@ -231,8 +231,8 @@ async fn high_level_discovery_matches_the_existing_plugin_provider() -> TestResu
|
||||
"enabled_tools": ["read", "deploy", "trusted", "package-only"],
|
||||
"disabled_tools": ["package-denied"],
|
||||
"tools": {
|
||||
"read": {"approval_mode": "prompt"},
|
||||
"deploy": {"approval_mode": "approve"},
|
||||
"read": {"approval_mode": "prompt", "output_token_limit": 12000},
|
||||
"deploy": {"approval_mode": "approve", "output_token_limit": 4000},
|
||||
"trusted": {"approval_mode": "approve"}
|
||||
}
|
||||
},
|
||||
@@ -255,6 +255,10 @@ disabled_tools = ["write"]
|
||||
|
||||
[plugins."selected-root".mcp_servers.first.tools.read]
|
||||
approval_mode = "approve"
|
||||
output_token_limit = 8000
|
||||
|
||||
[plugins."selected-root".mcp_servers.first.tools.deploy]
|
||||
output_token_limit = 9000
|
||||
|
||||
[plugins."selected-root".mcp_servers.first.tools.trusted]
|
||||
approval_mode = "approve"
|
||||
@@ -308,18 +312,21 @@ default_tools_approval_mode = "auto"
|
||||
"read".to_string(),
|
||||
McpServerToolConfig {
|
||||
approval_mode: Some(AppToolApproval::Prompt),
|
||||
output_token_limit: std::num::NonZeroUsize::new(8_000),
|
||||
},
|
||||
),
|
||||
(
|
||||
"deploy".to_string(),
|
||||
McpServerToolConfig {
|
||||
approval_mode: Some(AppToolApproval::Prompt),
|
||||
output_token_limit: std::num::NonZeroUsize::new(4_000),
|
||||
},
|
||||
),
|
||||
(
|
||||
"trusted".to_string(),
|
||||
McpServerToolConfig {
|
||||
approval_mode: Some(AppToolApproval::Approve),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
]),
|
||||
|
||||
Reference in new issue
Block a user