Skip to main content
Glama
JunWoo0406

TypeScript MCP Server Boilerplate

by JunWoo0406

calc

Perform basic arithmetic calculations by inputting two numbers and an operator (+, -, *, /) to get the result.

Instructions

두 숫자와 연산자를 입력하면 계산 결과를 반환합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes첫 번째 숫자
bYes두 번째 숫자
operatorYes연산자 (+, -, *, /)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes계산 결과

Implementation Reference

  • The implementation of the calc tool's execution logic.
        async ({ a, b, operator }) => {
            let result: number
    
            if (operator === '+') result = a + b
            else if (operator === '-') result = a - b
            else if (operator === '*') result = a * b
            else {
                if (b === 0) {
                    const errorText = '오류: 0으로 나눌 수 없습니다.'
                    return {
                        content: [{ type: 'text' as const, text: errorText }],
                        structuredContent: {
                            content: [{ type: 'text' as const, text: errorText }]
                        }
                    }
                }
                result = a / b
            }
    
            const text = `${a} ${operator} ${b} = ${result}`
            return {
                content: [{ type: 'text' as const, text }],
                structuredContent: {
                    content: [{ type: 'text' as const, text }]
                }
            }
        }
    )
  • src/index.ts:60-81 (registration)
    The registration and schema definition for the calc tool.
    server.registerTool(
        'calc',
        {
            description: '두 숫자와 연산자를 입력하면 계산 결과를 반환합니다.',
            inputSchema: z.object({
                a: z.number().describe('첫 번째 숫자'),
                b: z.number().describe('두 번째 숫자'),
                operator: z
                    .enum(['+', '-', '*', '/'])
                    .describe('연산자 (+, -, *, /)')
            }),
            outputSchema: z.object({
                content: z
                    .array(
                        z.object({
                            type: z.literal('text'),
                            text: z.string().describe('계산 결과')
                        })
                    )
                    .describe('계산 결과')
            })
        },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It mentions returning a calculation result, but does not disclose error handling (e.g., division by zero), numeric precision limits, or other behavioral edge cases that would help an agent predict failure modes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single efficient sentence with zero waste. It is appropriately front-loaded with the core action (input) and result (return) clearly stated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity, 100% schema coverage, and existence of an output schema, the description is sufficient. It acknowledges the return value (계산 결과), which is adequate when output schema details are available separately, though it could mention error conditions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, establishing a baseline of 3. The description ('두 숫자와 연산자를 입력하면') essentially restates what the schema already documents without adding syntax guidance, valid ranges, or semantic relationships between parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs calculations (계산 결과를 반환합니다) on two numbers using an operator. It effectively distinguishes from siblings (generate-image, geocode, etc.) by specifying the mathematical nature of the operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, or when not to use it. While the siblings are in different domains, the description does not explicitly state decision criteria for invoking this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/JunWoo0406/my-mcp-server'

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