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:
@@ -213,6 +213,26 @@ export class McpClientTool implements INodeType {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
placeholder: 'Add Option',
|
||||
description: 'Additional options to add',
|
||||
type: 'collection',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Timeout',
|
||||
name: 'timeout',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
default: 60000,
|
||||
description: 'Time in ms to wait for tool calls to finish',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -228,6 +248,7 @@ export class McpClientTool implements INodeType {
|
||||
itemIndex,
|
||||
) as McpAuthenticationOption;
|
||||
const node = this.getNode();
|
||||
const timeout = this.getNodeParameter('options.timeout', itemIndex, 60000) as number;
|
||||
|
||||
let serverTransport: McpServerTransport;
|
||||
let endpointUrl: string;
|
||||
@@ -293,7 +314,7 @@ export class McpClientTool implements INodeType {
|
||||
logWrapper(
|
||||
mcpToolToDynamicTool(
|
||||
tool,
|
||||
createCallTool(tool.name, client.result, (errorMessage) => {
|
||||
createCallTool(tool.name, client.result, timeout, (errorMessage) => {
|
||||
const error = new NodeOperationError(node, errorMessage, { itemIndex });
|
||||
void this.addOutputData(NodeConnectionTypes.AiTool, itemIndex, error);
|
||||
this.logger.error(`McpClientTool: Tool "${tool.name}" failed to execute`, { error });
|
||||
|
||||
Reference in New Issue
Block a user