notifyTool method

Future<void> notifyTool(
  1. String name, {
  2. McpJsonMap arguments = const <String, Object?>{},
  3. bool streamable = true,
  4. String? protocolVersion,
  5. Map<String, String> headers = const <String, String>{},
})

Invokes an MCP tool as a notification through the active session.

Implementation

Future<void> notifyTool(
  String name, {
  McpJsonMap arguments = const <String, Object?>{},
  bool streamable = true,
  String? protocolVersion,
  Map<String, String> headers = const <String, String>{},
}) {
  final toolName = _validatedMcpToolName(name, 'name');
  return notification(
    'tools/call',
    params: <String, Object?>{'name': toolName, 'arguments': arguments},
    streamable: streamable,
    protocolVersion: protocolVersion,
    headers: _headersWithToolParameterHeaders(toolName, arguments, headers),
  );
}