Skip to main content
Glama
CalcsLive

CalcsLive MCP Server

by CalcsLive

calcslive_calculate

Perform unit-aware engineering calculations with automatic unit conversions and dependency resolution using CalcsLive articles. Input values with units to get calculated outputs.

Instructions

Perform unit-aware engineering calculations using CalcsLive articles. Automatically handles unit conversions and dependency calculations. Example: Calculate hydro power with flow rate 150 m³/s and head 25m. Returns calculated outputs with values and units.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
articleIdYesArticle Short ID (e.g., 'pump-calc-abc'). Use calcslive_validate to discover available articles.
inputsYesInput PQ values with units. Example: {velocity: {value: 25, unit: 'm/s'}, mass: {value: 1500, unit: 'kg'}}
outputsNoOptional output unit preferences. Example: {distance: {unit: 'km'}}

Implementation Reference

  • Executes the calcslive_calculate tool by POSTing articleId, inputs, and outputs to the CalcsLive API calculate endpoint, then returns the formatted calculation result or error.
    if (request.params.name === "calcslive_calculate") {
      const { articleId, inputs, outputs = {} } = request.params.arguments as any;
    
      try {
        const response = await fetch(`${CALCSLIVE_API_BASE}/api/v1/calculate`, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            articleId,
            apiKey: API_KEY,
            inputs,
            outputs
          }),
        });
    
        if (!response.ok) {
          const errorData = await response.json() as any;
          throw new Error(errorData.error?.message || `API error: ${response.status}`);
        }
    
        const result = await response.json() as any;
    
        // Format response for MCP
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result.data.calculation, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error performing calculation: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:52-96 (registration)
    Registers the calcslive_calculate tool in the ListTools response, including name, description, and detailed inputSchema for articleId, inputs (with value/unit), and optional outputs.
    {
      name: "calcslive_calculate",
      description: "Perform unit-aware engineering calculations using CalcsLive articles. Automatically handles unit conversions and dependency calculations. Example: Calculate hydro power with flow rate 150 m³/s and head 25m. Returns calculated outputs with values and units.",
      inputSchema: {
        type: "object",
        properties: {
          articleId: {
            type: "string",
            description: "Article Short ID (e.g., 'pump-calc-abc'). Use calcslive_validate to discover available articles."
          },
          inputs: {
            type: "object",
            description: "Input PQ values with units. Example: {velocity: {value: 25, unit: 'm/s'}, mass: {value: 1500, unit: 'kg'}}",
            additionalProperties: {
              type: "object",
              properties: {
                value: {
                  type: "number",
                  description: "Numeric value for this input"
                },
                unit: {
                  type: "string",
                  description: "Unit for this value (e.g., 'm/s', 'kg', 'kW'). Supports both superscript (m³) and caret (m^3) notation."
                }
              },
              required: ["value", "unit"]
            }
          },
          outputs: {
            type: "object",
            description: "Optional output unit preferences. Example: {distance: {unit: 'km'}}",
            additionalProperties: {
              type: "object",
              properties: {
                unit: {
                  type: "string",
                  description: "Desired output unit (optional)"
                }
              }
            }
          }
        },
        required: ["articleId", "inputs"]
      }
    },
  • Input schema definition for the calcslive_calculate tool, specifying structure for articleId, inputs as objects with value and unit, and optional outputs.
    inputSchema: {
      type: "object",
      properties: {
        articleId: {
          type: "string",
          description: "Article Short ID (e.g., 'pump-calc-abc'). Use calcslive_validate to discover available articles."
        },
        inputs: {
          type: "object",
          description: "Input PQ values with units. Example: {velocity: {value: 25, unit: 'm/s'}, mass: {value: 1500, unit: 'kg'}}",
          additionalProperties: {
            type: "object",
            properties: {
              value: {
                type: "number",
                description: "Numeric value for this input"
              },
              unit: {
                type: "string",
                description: "Unit for this value (e.g., 'm/s', 'kg', 'kW'). Supports both superscript (m³) and caret (m^3) notation."
              }
            },
            required: ["value", "unit"]
          }
        },
        outputs: {
          type: "object",
          description: "Optional output unit preferences. Example: {distance: {unit: 'km'}}",
          additionalProperties: {
            type: "object",
            properties: {
              unit: {
                type: "string",
                description: "Desired output unit (optional)"
              }
            }
          }
        }
      },
      required: ["articleId", "inputs"]
    }

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/CalcsLive/calcslive-mcp-server'

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