Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/mcp/src/core/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ pub enum BuiltinToolType {
CodeInterpreter,
/// File search tool (OpenAI: file_search)
FileSearch,
/// Image generation tool (OpenAI: image_generation)
ImageGeneration,
}

impl BuiltinToolType {
Expand All @@ -311,6 +313,7 @@ impl BuiltinToolType {
BuiltinToolType::WebSearchPreview => ResponseFormatConfig::WebSearchCall,
BuiltinToolType::CodeInterpreter => ResponseFormatConfig::CodeInterpreterCall,
BuiltinToolType::FileSearch => ResponseFormatConfig::FileSearchCall,
BuiltinToolType::ImageGeneration => ResponseFormatConfig::ImageGenerationCall,
}
}
}
Expand All @@ -321,6 +324,7 @@ impl fmt::Display for BuiltinToolType {
BuiltinToolType::WebSearchPreview => write!(f, "web_search_preview"),
BuiltinToolType::CodeInterpreter => write!(f, "code_interpreter"),
BuiltinToolType::FileSearch => write!(f, "file_search"),
BuiltinToolType::ImageGeneration => write!(f, "image_generation"),
}
}
}
Expand Down Expand Up @@ -350,6 +354,7 @@ pub enum ResponseFormatConfig {
WebSearchCall,
CodeInterpreterCall,
FileSearchCall,
ImageGenerationCall,
}

/// Argument mapping configuration for tool aliases.
Expand Down Expand Up @@ -1025,6 +1030,10 @@ tools:
"\"code_interpreter_call\"",
),
(ResponseFormatConfig::FileSearchCall, "\"file_search_call\""),
(
ResponseFormatConfig::ImageGenerationCall,
"\"image_generation_call\"",
),
];

for (format, expected) in formats {
Expand Down Expand Up @@ -1191,6 +1200,7 @@ policy:
(BuiltinToolType::WebSearchPreview, "\"web_search_preview\""),
(BuiltinToolType::CodeInterpreter, "\"code_interpreter\""),
(BuiltinToolType::FileSearch, "\"file_search\""),
(BuiltinToolType::ImageGeneration, "\"image_generation\""),
];

for (builtin_type, expected) in types {
Expand All @@ -1216,6 +1226,10 @@ policy:
BuiltinToolType::FileSearch.response_format(),
ResponseFormatConfig::FileSearchCall
);
assert_eq!(
BuiltinToolType::ImageGeneration.response_format(),
ResponseFormatConfig::ImageGenerationCall
);
}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion crates/mcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ pub use responses_bridge::{
pub use tenant::{SessionId, TenantContext, TenantId};
// Re-export from transform
pub use transform::{
extract_embedded_openai_responses, mcp_response_item_id, ResponseFormat, ResponseTransformer,
compact_image_generation_output, extract_embedded_openai_responses, mcp_response_item_id,
ResponseFormat, ResponseTransformer,
};
3 changes: 2 additions & 1 deletion crates/mcp/src/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mod transformer;
mod types;

pub use transformer::{
extract_embedded_openai_responses, mcp_response_item_id, ResponseTransformer,
compact_image_generation_output, extract_embedded_openai_responses, mcp_response_item_id,
ResponseTransformer,
};
pub use types::ResponseFormat;
Loading
Loading