Skip to content

Conversation

@jozkee
Copy link
Member

@jozkee jozkee commented Dec 6, 2025

Introduce ServiceActionContent and implement it in CodeInterpreter and McpServerTool contents.

Naming considerations:

  • HostedServiceCallContent - Not nice for Result contents, and may be confusing with FunctionCallContent.
  • HostedServiceSideContent - "Side" is uncommon in the codebase.
  • HostedServiceContent - If we use this name, HostedFileContent should also extend it which escapes the scope of "content about server side actions".
  • ServiceActionContent - Breaks the Hosted prefix we've been using but I like the shortness; con: "Action" may be too broad.
Microsoft Reviewers: Open in CodeFlow

@jozkee jozkee requested a review from stephentoub December 6, 2025 00:42
@jozkee jozkee requested a review from a team as a code owner December 6, 2025 00:42
Copilot AI review requested due to automatic review settings December 6, 2025 00:42
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Dec 6, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces ServiceActionContent as a new base class for content types representing service-side actions. It refactors CodeInterpreterToolCallContent, CodeInterpreterToolResultContent, McpServerToolCallContent, and McpServerToolResultContent to extend this base class, consolidating the common Id property (previously CallId). This change improves the type hierarchy and provides a cleaner abstraction for service-hosted operations.

Key Changes

  • Introduces ServiceActionContent base class with a required Id property
  • Updates code interpreter and MCP server tool content classes to inherit from ServiceActionContent
  • Standardizes property naming from CallId to Id across all service action content types
  • Makes id a required constructor parameter (previously nullable/optional)

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/ServiceActionContent.cs New base class for service-side actions with required Id property
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/CodeInterpreterToolCallContent.cs Updated to extend ServiceActionContent and require id in constructor
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/CodeInterpreterToolResultContent.cs Updated to extend ServiceActionContent and require id in constructor
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/McpServerToolCallContent.cs Updated to extend ServiceActionContent, removing duplicate CallId property
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/McpServerToolResultContent.cs Updated to extend ServiceActionContent, removing duplicate CallId property
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/AIContent.cs Added ServiceActionContent to polymorphic type comments
src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/AIJsonUtilities.Defaults.cs Registered ServiceActionContent for JSON serialization
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseExtensions.cs Updated coalescing logic to use Id property
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs Updated to use Id property and new constructors
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIAssistantsChatClient.cs Updated to use new constructors with required id
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/ServiceActionContentTests.cs New comprehensive test suite for ServiceActionContent
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/CodeInterpreterToolCallContentTests.cs Updated tests for constructor changes and added serialization test
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/CodeInterpreterToolResultContentTests.cs Updated tests for constructor changes and added validation test
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/McpServerToolCallContentTests.cs Updated tests for property renaming and added serialization test
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/McpServerToolResultContentTests.cs Updated tests for property renaming
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/AIContentTests.cs Added ServiceActionContent to polymorphic serialization test
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs Updated integration tests to use Id property
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs Updated integration tests to use Id property
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIAssistantChatClientIntegrationTests.cs Simplified assertions to use required Id property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant