feat(MCP Client Tool Node): Add Timeout config for the MCP Client tool (#15886)

Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
jreyesr
2025-08-14 12:28:12 -05:00
committed by GitHub
parent f1a87af059
commit f575427d4d
3 changed files with 73 additions and 3 deletions

View File

@@ -77,7 +77,8 @@ export const getErrorDescriptionFromToolCall = (result: unknown): string | undef
};
export const createCallTool =
(name: string, client: Client, onError: (error: string) => void) => async (args: IDataObject) => {
(name: string, client: Client, timeout: number, onError: (error: string) => void) =>
async (args: IDataObject) => {
let result: Awaited<ReturnType<Client['callTool']>>;
function handleError(error: unknown) {
@@ -88,7 +89,9 @@ export const createCallTool =
}
try {
result = await client.callTool({ name, arguments: args }, CompatibilityCallToolResultSchema);
result = await client.callTool({ name, arguments: args }, CompatibilityCallToolResultSchema, {
timeout,
});
} catch (error) {
return handleError(error);
}