Interface IMcpTool
A tool that speaks the MCP result model directly, returning content blocks rather than a JSON string.
public interface IMcpTool : ITool
- Inherited Members
Remarks
Any ITool can be exposed through McpServer: its JSON output is wrapped in a single text block. Implement this interface when the tool needs to return images the caller should look at, resource links instead of inline payloads, a structured projection alongside the text, or a corrective failure message.
Annotations are derived from IToolMetadata when a tool implements it, so most
tools should implement that interface and leave Annotations returning null.
Supply annotations explicitly only to override the derived values.
Properties
- Annotations
Gets optional behavioral hints. Return
nullto derive them from IToolMetadata.
- OutputSchema
Gets an optional JSON Schema describing the shape of StructuredContentJson, or
nullwhen the tool returns no structured projection.
- Title
Gets an optional human-readable title for display. May be
null, in which case consumers fall back to Name.
Methods
- CallAsync(string, McpRequestContext, CancellationToken)
Executes the tool.