Skip to content

Commit 1ae245a

Browse files
committed
#7486 tools call endpoint
1 parent 70f3539 commit 1ae245a

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

ai/mcp/server/github-workflow/services/toolService.mjs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,27 @@ async function callTool(toolName, args) {
7070
throw new Error(`Tool "${toolName}" not found or not implemented.`);
7171
}
7272

73-
// This is a simplified argument handling. A real implementation would be more robust.
74-
const argValues = args ? Object.values(args) : [];
75-
return tool.handler(...argValues);
73+
// Explicitly map arguments based on toolName
74+
switch (toolName) {
75+
case 'listLabels':
76+
return tool.handler();
77+
case 'listPullRequests':
78+
return tool.handler(args);
79+
case 'checkoutPullRequest':
80+
case 'getPullRequestDiff':
81+
case 'getConversation':
82+
return tool.handler(args.prNumber);
83+
case 'createComment':
84+
return tool.handler(args.prNumber, args.body);
85+
case 'addLabels':
86+
case 'removeLabels':
87+
return tool.handler(args.issueNumber, args.labels);
88+
default:
89+
throw new Error(`Unknown tool: ${toolName}`);
90+
}
7691
}
7792

7893
export {
7994
listTools,
8095
callTool
81-
};
96+
};

0 commit comments

Comments
 (0)