Repository navigation
Python: Add tool call/result content types and update connectors and samples - #2971
Eduard van Valkenburg (eavanvalkenburg) merged 22 commits into
Conversation
Eduard van Valkenburg (eavanvalkenburg)
left a comment
There was a problem hiding this comment.
looking good so far, there are also samples with image generation and code, can you update those as well Copilot
Updated the OpenAI image generation and code interpreter samples to use the new tool call/result content shapes and proper tool lists (1079faa). Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
some additional comments, and the McpServer contents also need handling, also those names should be MCP instead of Mcp (python standard vs dotnet standard) Copilot
There was a problem hiding this comment.
couple of notes, and OpenAI Assistants also supports Code Interpreter, so that needs handling. Anthropic also support HostedMCPTool and Code interpreter, so those types need handling as well. Copilot
Updated MCP content naming, parsing, and connector handling; also added option translation for image generation tools as requested (3866935).
Added code interpreter and MCP handling across Responses, Assistants, and Anthropic connectors to emit the new content types (3866935). |
|
Copilot FunctionApprovalRequestContent also needs to allow MCPServerToolCallContent as the function_call inside of it. |
|
Copilot python/packages/core/agent_framework/openai/_responses_client.py:348 is not needed, folks should use the Tool type |
Co-authored-by: eavanvalkenburg <[email protected]>
Co-authored-by: eavanvalkenburg <[email protected]>
Co-authored-by: eavanvalkenburg <[email protected]>
Co-authored-by: eavanvalkenburg <[email protected]>
Co-authored-by: eavanvalkenburg <[email protected]>
Co-authored-by: eavanvalkenburg <[email protected]>
Co-authored-by: eavanvalkenburg <[email protected]>
Co-authored-by: eavanvalkenburg <[email protected]>
Motivation and Context
MEAI introduced new content types for tool calls/results (code interpreter, MCP server, image generation) and enhancements to hosted file metadata; Python core needed parity so connectors can emit/consume these shapes.
Description
CodeInterpreterToolCallContent,CodeInterpreterToolResultContent,ImageGenerationToolCallContent,ImageGenerationToolResultContent,MCPServerToolCallContent,MCPServerToolResultContent; extendedHostedFileContentwith optionalmedia_typeandname; updatedContentsunion and serialization.FunctionApprovalRequestContentnow acceptsMCPServerToolCallContentin addition to standard function calls.HostedImageGenerationToolwith typed options/additional properties and translate those options to OpenAI Responses parameters.FunctionCallContentfor non-code-execution tools, fixed missingChatResponse/CitationAnnotationimports and code-block handling to satisfy type checks, and ensured MCP parsing/typing is consistent.agentlightningis not installed.Example:
Contribution Checklist
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.