expectToolCallSucceeds function
Future<CallToolResult>
expectToolCallSucceeds(
- McpServerHarness harness,
- String name, {
- Map<
String, Object?> ? arguments,
Calls the tool name with arguments and fails the current test if the
call reports an in-band error.
Returns the CallToolResult so the test can make further assertions on
the content.
Implementation
Future<CallToolResult> expectToolCallSucceeds(
McpServerHarness harness,
String name, {
Map<String, Object?>? arguments,
}) async {
final result = await harness.callTool(name, arguments: arguments);
if (result.isError ?? false) {
fail(
'Expected tool "$name" to succeed, but it answered with an error: '
'${_contentSummary(result)}',
);
}
return result;
}