Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update src/controllers/mcp.controller.ts
This is appropriate error handling.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
castlenthesky and coderabbitai[bot] authored Feb 7, 2026
commit 29b13fc1c3258d34dd3cc2e57cb79371c707dc12
13 changes: 12 additions & 1 deletion src/controllers/mcp.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,18 @@ export class MCPController {
}

if (method === 'tools/call') {
const { name, arguments: args } = req.body.params;
const params = req.body.params;
if (!params || !params.name) {
return res.status(200).json({
jsonrpc: '2.0',
id,
error: {
code: -32602,
message: 'Invalid params: name is required'
}
});
}
Comment on lines +185 to +194
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s no test covering the tools/call path where params or params.name is missing and the controller returns -32602. Add a Jest test that calls handleRpcRequest with method: 'tools/call' and missing/invalid params to lock in this error behavior.

Copilot uses AI. Check for mistakes.
const { name, arguments: args } = params;

if (name === 'graph_query') {
try {
Expand Down