MCP server providing basic arithmetic operations
Single tool 'calculate' with basic arithmetic operations. While the tool is explicitly registered with a schema and description, the implementation has critical gaps in parameter documentation and error handling patterns. The description is minimal (9 chars in English: 'Execute basic arithmetic operations'), lacks guidance on when to use the tool, and parameters x and y are marked as not required despite being essential for any meaningful calculation. The schema is present and correctly typed, but parameter descriptions are extremely brief and lack format/constraint guidance. Error handling is minimal, only division-by-zero is caught; no guidance for invalid inputs or retry recovery. The tool name 'calculate' is generic and does not follow verb_noun conventions (e.g., 'compute_arithmetic' would be clearer). Output is plain text ('%.2f' formatted), not structured. No pagination, no batching, no chaining IDs. The server supports resources but does not use them. Logging is enabled but no evidence of proper audit trails or permission gates. Overall, this is a minimalist proof-of-concept that would require substantial work to meet production patterns.
执行基本算术运算
Tool name 'calculate' is generic and does not follow verb_noun convention. 'execute_arithmetic' or 'compute_math' would better signal intent and aid LLM tool selection.
Parameters 'x' and 'y' marked as not required (required:false) despite being essential for arithmetic operations. Passing operation='add' without x or y will cause a type assertion panic. Either make them required or provide meaningful defaults with clear description.
Parameter descriptions are minimal and lack constraint documentation. 'x' and 'y' should specify: 'Numeric operand (any decimal value)' or similar. 'operation' should clarify: 'Arithmetic operation type. add: sum x+y, subtract: x-y, multiply: x*y, divide: x/y (y cannot be zero).'
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | F | 35 | <=2025-11-25 | v2 |
| 2026-03-09 | F | 32 | - | v1 |
Tool description (English: 'Execute basic arithmetic operations') is too brief (9 chars) and does not guide LLM on when or why to select this tool. Should explain: 'Performs arithmetic calculations. Supports add, subtract, multiply, divide. Returns result as decimal. Division by zero returns an error.'
Output is unstructured plain text (formatted float). Should return structured JSON with fields: {"result": 42.5, "operation": "add", "x": 10, "y": 32.5} to enable downstream chaining and clearer LLM reasoning.
Error handling only covers division-by-zero. Type assertion panics (line 'x := request.GetArguments()["x"].(float64)') if x or y are missing or wrong type. Should validate inputs and return actionable error: 'Invalid input: x must be a number, y must be a number. Example: {"operation": "add", "x": 5, "y": 3}'.
No tool annotations (readOnlyHint, destructiveHint, idempotentHint). This tool is read-only arithmetic and should declare it via toolAnnotations to help LLM plan safely.