Development
Measure cyclomatic and cognitive complexity across multiple programming languages
Call this tool from your code in three languages.
curl -X POST 'https://api.elysiatools.com/en/api/tools/code-complexity-analyzer' \
-H 'Content-Type: application/json' \
-d '{"sourceCode":"function score(order) {\n if (!order) return 0;\n let total = 0;\n for (const item of order.items) {\n if (item.discount) {\n total += item.price * 0.8;\n } else if (item.vip) {\n total += item.price * 0.9;\n } else {\n total += item.price;\n }\n }\n return total;\n}","language":"javascript","longFunctionThreshold":8,"nestingThreshold":2,"duplicateWindow":4}'Send a POST request with your inputs as JSON. File parameters require a separate upload first.
POST https://api.elysiatools.com/en/api/tools/code-complexity-analyzer| Name | Type | Required | Description |
|---|---|---|---|
| sourceCode | textarea | Yes | — |
| language | select | No | — |
| longFunctionThreshold | number | No | — |
| nestingThreshold | number | No | — |
| duplicateWindow | number | No | — |
Add this tool to your Model Context Protocol server so AI agents can list and call it.
Add this block to your MCP client configuration:
{
"mcpServers": {
"elysiatools-code-complexity-analyzer": {
"name": "code-complexity-analyzer",
"description": "Measure cyclomatic and cognitive complexity across multiple programming languages",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=code-complexity-analyzer",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}After connecting to the SSE endpoint, list the exposed tools:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoke the tool by its id, passing arguments built from its parameters:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "code-complexity-analyzer",
"arguments": {
"sourceCode": "function score(order) {\n if (!order) return 0;\n let total = 0;\n for (const item of order.items) {\n if (item.discount) {\n total += item.price * 0.8;\n } else if (item.vip) {\n total += item.price * 0.9;\n } else {\n total += item.price;\n }\n }\n return total;\n}",
"language": "javascript",
"longFunctionThreshold": 8,
"nestingThreshold": 2,
"duplicateWindow": 4
}
}
}JSON result
{
"key": {...},
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}Questions or issues? Contact [email protected]