callInProcess method
Dispatch a registered tool entirely in-process, with no external
MCP client involved. Used by JS atoms such as host.mcp.callTool.
Throws ToolNotFoundException for unregistered tool names.
Implementation
Future<dynamic> callInProcess(
String tool,
Map<String, dynamic> params, {
String? scope,
}) async {
final name = resolveInProcess(tool, scope: scope);
final handler = name == null ? null : _inProcess[name];
if (handler == null) {
throw ToolNotFoundException(tool, _inProcess.keys.toList());
}
try {
return await handler(params);
} catch (e, st) {
_logger.logError('In-process tool failed', e, st, {'tool': tool});
throw ToolExecutionException(tool, cause: e);
}
}