math_solve
Solve math problems using Chain of Draft reasoning to generate minimalistic intermediate steps, reducing token usage while maintaining accuracy.
Instructions
Solve a math problem using Chain of Draft reasoning
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| approach | No | Force 'CoD' or 'CoT' approach | |
| max_words_per_step | No | Maximum words per reasoning step | |
| problem | Yes | The math problem to solve |
Implementation Reference
- index.js:617-637 (handler)Handler for 'math_solve' tool call in the JS MCP server. Delegates to chainOfDraftClient.solveWithReasoning with domain='math' and formats the response.// Math solver if (name === "math_solve") { const result = await chainOfDraftClient.solveWithReasoning({ ...args, domain: "math" }); const formattedResponse = `Chain of ${result.approach} reasoning (${result.word_limit} word limit):\n\n` + `${result.reasoning_steps}\n\n` + `Final answer: ${result.final_answer}\n\n` + `Stats: ${result.token_count} tokens, ${result.execution_time_ms.toFixed(0)}ms, ` + `complexity score: ${result.complexity}`; return { content: [{ type: "text", text: formattedResponse }] }; }
- server.py:82-100 (handler)Handler function for 'math_solve' tool in the Python FastMCP server. Thin wrapper around chain_of_draft_solve with domain='math'.@app.tool() async def math_solve( problem: str, approach: str = None, max_words_per_step: int = None ) -> str: """Solve a math problem using Chain of Draft reasoning. Args: problem: The math problem to solve approach: Force "CoD" or "CoT" approach (default: auto-select) max_words_per_step: Maximum words per step (default: adaptive) """ return await chain_of_draft_solve( problem=problem, domain="math", approach=approach, max_words_per_step=max_words_per_step )
- index.js:459-480 (schema)Input schema definition for the 'math_solve' tool in the JS implementation.const MATH_TOOL = { name: "math_solve", description: "Solve a math problem using Chain of Draft reasoning", inputSchema: { type: "object", properties: { problem: { type: "string", description: "The math problem to solve" }, approach: { type: "string", description: "Force 'CoD' or 'CoT' approach" }, max_words_per_step: { type: "number", description: "Maximum words per reasoning step" } }, required: ["problem"] } };
- index.js:581-591 (registration)Registration of 'math_solve' tool (as MATH_TOOL) in the listTools handler for the JS MCP server.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ CHAIN_OF_DRAFT_TOOL, MATH_TOOL, CODE_TOOL, LOGIC_TOOL, PERFORMANCE_TOOL, TOKEN_TOOL, COMPLEXITY_TOOL ], }));
- server.py:82-82 (registration)FastMCP decorator @app.tool() that registers the math_solve handler function.@app.tool()