tool method
void
tool({
- required String name,
- String? title,
- String? description,
- ToolSchema? inputSchema,
- ToolSchema? outputSchema,
- ToolAnnotations? annotations,
- required ToolHandler handler,
Register an MCP tool.
inputSchema defaults to ToolSchema(type: 'object') when omitted.
Implementation
void tool({
required String name,
String? title,
String? description,
ToolSchema? inputSchema,
ToolSchema? outputSchema,
ToolAnnotations? annotations,
required ToolHandler handler,
}) {
_tools[name] = _ToolEntry(
Tool(
name: name,
title: title,
description: description,
inputSchema: inputSchema ?? ToolSchema(type: 'object'),
outputSchema: outputSchema,
annotations: annotations,
),
handler,
);
}