Skip to main content
Glama
yigitkonur

example-mcp-server-stdio

by yigitkonur

explain_formula

Understand mathematical formulas with interactive explanations and optional examples to clarify complex calculations.

Instructions

Explain a mathematical formula interactively

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formulaYesThe formula to explain
examplesNoInclude examples

Implementation Reference

  • Handler function for 'explain_formula' tool: logs the execution, increments request count, and returns a markdown-formatted explanation of the provided formula, optionally including example placeholders.
    async ({ formula, examples }) => {
      log.info('Explaining formula');
      requestCount++;
    
      return {
        content: [
          {
            type: 'text',
            text:
              `## Formula Explanation: ${formula}\n\n` +
              `This tool provides interactive explanations of mathematical formulas.\n` +
              `${examples ? '\n### Examples:\n- Example calculations would be shown here\n- Visual representations might be included\n' : ''}\n` +
              `**Note**: This tool may use elicitInput for interactive learning.`,
          },
        ],
      };
  • Zod input schema for 'explain_formula' tool defining required 'formula' string and optional 'examples' boolean.
    const explainFormulaInputSchema = {
      formula: z.string().describe('The formula to explain'),
      examples: z.boolean().optional().describe('Include examples'),
    };
  • src/server.ts:757-781 (registration)
    Registration of the 'explain_formula' MCP tool, specifying title, description, input schema, and inline handler function.
    server.registerTool(
      'explain_formula',
      {
        title: 'Explain Formula',
        description: 'Explain a mathematical formula interactively',
        inputSchema: explainFormulaInputSchema,
      },
      async ({ formula, examples }) => {
        log.info('Explaining formula');
        requestCount++;
    
        return {
          content: [
            {
              type: 'text',
              text:
                `## Formula Explanation: ${formula}\n\n` +
                `This tool provides interactive explanations of mathematical formulas.\n` +
                `${examples ? '\n### Examples:\n- Example calculations would be shown here\n- Visual representations might be included\n' : ''}\n` +
                `**Note**: This tool may use elicitInput for interactive learning.`,
            },
          ],
        };
      },
    );

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/yigitkonur/example-mcp-server-stdio'

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