mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
fix: remove unreachable else branches in MCP routes
CodeRabbit identified dead code - the else blocks were unreachable since validation ensures serverId or serverConfig is truthy. Simplified to ternary expression. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,18 +37,10 @@ export function createListToolsHandler(mcpTestService: MCPTestService) {
|
||||
return;
|
||||
}
|
||||
|
||||
let result;
|
||||
if (body.serverId) {
|
||||
result = await mcpTestService.testServerById(body.serverId);
|
||||
} else if (body.serverConfig) {
|
||||
result = await mcpTestService.testServer(body.serverConfig);
|
||||
} else {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'Invalid request',
|
||||
});
|
||||
return;
|
||||
}
|
||||
// At this point, we know at least one of serverId or serverConfig is truthy
|
||||
const result = body.serverId
|
||||
? await mcpTestService.testServerById(body.serverId)
|
||||
: await mcpTestService.testServer(body.serverConfig!);
|
||||
|
||||
// Return only tool-related information
|
||||
res.json({
|
||||
|
||||
@@ -37,18 +37,10 @@ export function createTestServerHandler(mcpTestService: MCPTestService) {
|
||||
return;
|
||||
}
|
||||
|
||||
let result;
|
||||
if (body.serverId) {
|
||||
result = await mcpTestService.testServerById(body.serverId);
|
||||
} else if (body.serverConfig) {
|
||||
result = await mcpTestService.testServer(body.serverConfig);
|
||||
} else {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: 'Invalid request',
|
||||
});
|
||||
return;
|
||||
}
|
||||
// At this point, we know at least one of serverId or serverConfig is truthy
|
||||
const result = body.serverId
|
||||
? await mcpTestService.testServerById(body.serverId)
|
||||
: await mcpTestService.testServer(body.serverConfig!);
|
||||
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user