mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let result;
|
// At this point, we know at least one of serverId or serverConfig is truthy
|
||||||
if (body.serverId) {
|
const result = body.serverId
|
||||||
result = await mcpTestService.testServerById(body.serverId);
|
? await mcpTestService.testServerById(body.serverId)
|
||||||
} else if (body.serverConfig) {
|
: await mcpTestService.testServer(body.serverConfig!);
|
||||||
result = await mcpTestService.testServer(body.serverConfig);
|
|
||||||
} else {
|
|
||||||
res.status(400).json({
|
|
||||||
success: false,
|
|
||||||
error: 'Invalid request',
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return only tool-related information
|
// Return only tool-related information
|
||||||
res.json({
|
res.json({
|
||||||
|
|||||||
@@ -37,18 +37,10 @@ export function createTestServerHandler(mcpTestService: MCPTestService) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let result;
|
// At this point, we know at least one of serverId or serverConfig is truthy
|
||||||
if (body.serverId) {
|
const result = body.serverId
|
||||||
result = await mcpTestService.testServerById(body.serverId);
|
? await mcpTestService.testServerById(body.serverId)
|
||||||
} else if (body.serverConfig) {
|
: await mcpTestService.testServer(body.serverConfig!);
|
||||||
result = await mcpTestService.testServer(body.serverConfig);
|
|
||||||
} else {
|
|
||||||
res.status(400).json({
|
|
||||||
success: false,
|
|
||||||
error: 'Invalid request',
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
res.json(result);
|
res.json(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user