mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user