Skip to content

Commit 441efc7

Browse files
committed
Add McpServerToolAttribute.UseStructuredContent
1 parent d2348c7 commit 441efc7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/ModelContextProtocol.Core/Server/AIFunctionMcpServerTool.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ private static McpServerToolCreateOptions DeriveOptions(MethodInfo method, McpSe
232232
{
233233
newOptions.ReadOnly ??= readOnly;
234234
}
235+
236+
newOptions.UseStructuredContent = toolAttr.UseStructuredContent;
235237
}
236238

237239
if (method.GetCustomAttribute<DescriptionAttribute>() is { } descAttr)

src/ModelContextProtocol.Core/Server/McpServerToolAttribute.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,13 @@ public bool ReadOnly
240240
get => _readOnly ?? ReadOnlyDefault;
241241
set => _readOnly = value;
242242
}
243+
244+
/// <summary>
245+
/// Gets or sets whether the tool should report an output schema for structured content.
246+
/// </summary>
247+
/// <remarks>
248+
/// When enabled, the tool will attempt to populate the <see cref="Tool.OutputSchema"/>
249+
/// and provide structured content in the <see cref="CallToolResponse.StructuredContent"/> property.
250+
/// </remarks>
251+
public bool UseStructuredContent { get; set; }
243252
}

0 commit comments

Comments
 (0)