callConnectanumToolDirect method

Future<McpJsonMap> callConnectanumToolDirect(
  1. String name, {
  2. Object? id,
  3. McpJsonMap arguments = const <String, Object?>{},
  4. String? protocolVersion,
  5. Map<String, String> headers = const <String, String>{},
})

Calls a Connectanum JSON tool through the direct API.

Implementation

Future<McpJsonMap> callConnectanumToolDirect(
  String name, {
  Object? id,
  McpJsonMap arguments = const <String, Object?>{},
  String? protocolVersion,
  Map<String, String> headers = const <String, String>{},
}) async {
  const method = 'connectanum.tool.call';
  final toolName = _validatedMcpToolName(name, 'name');
  final response = await request(
    method,
    id: id,
    params: <String, Object?>{'name': toolName, 'arguments': arguments},
    streamable: false,
    includeSession: false,
    protocolVersion: protocolVersion,
    headers: _headersWithToolParameterHeaders(toolName, arguments, headers),
  );
  return _validatedToolCallResult(
    _jsonRpcResultFrom(response, method: method),
    label: '$method result',
  );
}