Skip to main content
Glama

calculate

Perform basic mathematical calculations using expressions like '2 + 2' or '10 * 5' on the Algorand MCP Server, facilitating utility tasks within blockchain operations.

Instructions

Perform basic mathematical calculations

Input Schema

NameRequiredDescriptionDefault
expressionYesMathematical expression to evaluate (e.g., "2 + 2", "10 * 5")

Input Schema (JSON Schema)

{ "properties": { "expression": { "description": "Mathematical expression to evaluate (e.g., \"2 + 2\", \"10 * 5\")", "type": "string" } }, "required": [ "expression" ], "type": "object" }

Implementation Reference

  • The handler for the 'calculate' tool that parses the input arguments, evaluates the mathematical expression safely using eval, and returns the result or an error message.
    case 'calculate': { const parsed = CalculateArgsSchema.parse(args); try { // Simple math evaluation (in production, use a safer math library) const result = eval(parsed.expression); return { content: [ { type: 'text', text: `Result: ${parsed.expression} = ${result}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error: Invalid mathematical expression - ${error}`, }, ], isError: true, }; } }
  • Zod schema defining the input structure for the 'calculate' tool, requiring a string 'expression'.
    const CalculateArgsSchema = z.object({ expression: z.string(), });
  • src/index.ts:114-127 (registration)
    Tool registration in the TOOLS array, defining the name, description, and JSON input schema for the MCP protocol.
    { name: 'calculate', description: 'Perform basic mathematical calculations', inputSchema: { type: 'object', properties: { expression: { type: 'string', description: 'Mathematical expression to evaluate (e.g., "2 + 2", "10 * 5")', }, }, required: ['expression'], }, },

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jake-loranger/algorand-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server