Skip to main content
Glama

Cloudflare Remix Vite MCP

by kentcdodds
tools.ts967 B
import { z } from 'zod' import { type MathMCP } from './index.tsx' type OperationFn = (left: number, right: number) => number let operations = { '+': (left, right) => left + right, '-': (left, right) => left - right, '*': (left, right) => left * right, '/': (left, right) => left / right, } satisfies Record<string, OperationFn> export async function registerTools(agent: MathMCP) { agent.server.registerTool( 'do_math', { description: 'Solve a math problem', inputSchema: { left: z.number(), right: z.number(), operator: z.enum( Object.keys(operations) as [ keyof typeof operations, ...Array<keyof typeof operations>, ], ), }, }, async ({ left, right, operator }) => { let operation = operations[operator] let result = operation(left, right) return { content: [ { type: 'text', text: `The result of ${left} ${operator} ${right} is ${result}`, }, ], } }, ) }

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/kentcdodds/cloudflare-remix-vite-mcp'

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