Skip to content

.NET: expose host-tool JsonSchema in LocalCodeAct - #8776

Open
Pasindu Madusha (epcm18) wants to merge 3 commits into
microsoft:mainfrom
epcm18:fix/issue-8775-localcodeact-tool-schemas
Open

Pasindu Madusha (epcm18) wants to merge 3 commits into
microsoft:mainfrom
epcm18:fix/issue-8775-localcodeact-tool-schemas

Conversation

@epcm18

Copy link
Copy Markdown

Motivation & Context

InstructionBuilder.BuildExecuteCodeDescription in Microsoft.Agents.AI.LocalCodeAct listed each host AIFunction name and description but never read JsonSchema, so models could not learn parameter names, requiredness, descriptions, enums, or nested shapes for call_tool(...). This is the LocalCodeAct counterpart of #8446 / #8528. The Python fix (#8459) covered both of its runtimes; this PR brings the second .NET runtime in line.

Description & Review Guide

  • What are the major changes?
    • BuildExecuteCodeDescription appends each host tool's existing JsonSchema under Parameters (JSON Schema): when the schema describes properties, emits Parameters: none. for zero-argument tools, and stays silent for unconstrained schemas ({} or boolean roots). This is the same rendering and the same guards as .NET: include host-tool JsonSchema in Hyperlight execute_code descriptions #8528 so both .NET packages produce identical descriptions.
    • Regression coverage: parameterized tool, zero-parameter tool, and unconstrained schema in InstructionBuilderTests; description and code-only input schema assertions for both LocalExecuteCodeFunction (new test class) and LocalCodeActProvider.
    • README documents the behaviour, the model-visibility caveat for parameter metadata, and the JsonStringEnumConverter note for enums.
  • What is the impact of these changes? No public API changes. The execute_code input schema remains the single code parameter. No-tool output, approval behavior, and file-mount instructions are unchanged.
  • What do you want reviewers to focus on?

Related Issue

Fixes #8775
Partially addresses: #8446 #8125

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

Evidence

  • Old red: BuildExecuteCodeDescription_WithToolParameters_IncludesParameterMetadata fails on main (no parameter metadata in the description).
  • New green: dotnet test --project tests/Microsoft.Agents.AI.LocalCodeAct.UnitTests/Microsoft.Agents.AI.LocalCodeAct.UnitTests.csproj -f net10.0 → 109/109 passed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new C# test file violates the repository’s required UTF-8 BOM encoding convention.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Exposes host-tool JSON schemas in .NET LocalCodeAct descriptions while preserving the code-only execution schema.

Changes:

  • Renders parameter schemas and zero-parameter status.
  • Adds regression tests for both entry points.
  • Documents schema visibility and enum handling.
File Description
Internal/​InstructionBuilder.cs Adds host-tool schema rendering.
README.md Documents parameter metadata exposure.
InstructionBuilderTests.cs Tests schema rendering cases.
LocalExecuteCodeFunctionTests.cs Tests standalone function behavior.
LocalCodeActProviderTests.cs Tests provider-generated function behavior.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@epcm18

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@epcm18

Copy link
Copy Markdown
Author

Hi Eduard van Valkenburg (@eavanvalkenburg) , a gentle ping when you have a moment: this is the .NET counterpart of microsoft/agent-framework#8459. Would you be able to go through the changes and check whether they match? Could you also approve the workflow runs here and on microsoft/agent-framework#8528? Thanks!

This branch was previously deployed

1 inactive deployment
github-app-auth — 0deeecf8 Deployed Oct 3, 2026 by epcm18 via add_label #24375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: LocalCodeAct host-tool parameter schemas missing from execute_code descriptions

2 participants