Add structured output/output schema support for server-side tools. (#480)

* Add structured output/output schema support for server-side tools.

* Address feedback.

* Add McpServerToolAttribute.UseStructuredContent

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
This commit is contained in:
Eirik Tsarpalis 2025-06-06 08:20:12 +01:00 • committed by GitHub
commit fa017c04c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -240,4 +240,13 @@ public sealed class McpServerToolAttribute : Attribute
get => _readOnly ?? ReadOnlyDefault;
set => _readOnly = value;
}
/// <summary>
/// Gets or sets whether the tool should report an output schema for structured content.
/// </summary>
/// <remarks>
/// When enabled, the tool will attempt to populate the <see cref="Tool.OutputSchema"/>
/// and provide structured content in the <see cref="CallToolResponse.StructuredContent"/> property.
/// </remarks>
public bool UseStructuredContent { get; set; }
}