Skip to main content
Glama
devbrother2024

TypeScript MCP Server Boilerplate

geocode

Convert city names or addresses into latitude and longitude coordinates using the Nominatim OpenStreetMap service.

Instructions

도시명 또는 주소를 입력받아 위도·경도 좌표를 반환합니다. (Nominatim OpenStreetMap)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes검색할 도시명 또는 주소
limitNo반환할 결과 수 (기본값: 1, 최대: 5)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes좌표 결과

Implementation Reference

  • The 'geocode' tool is registered using `server.registerTool`. The handler logic uses Nominatim's OpenStreetMap API to fetch coordinates for a given query.
    server.registerTool(
        'geocode',
        {
            description: '도시명 또는 주소를 입력받아 위도·경도 좌표를 반환합니다. (Nominatim OpenStreetMap)',
            inputSchema: z.object({
                query: z.string().describe('검색할 도시명 또는 주소'),
                limit: z
                    .number()
                    .int()
                    .min(1)
                    .max(5)
                    .optional()
                    .default(1)
                    .describe('반환할 결과 수 (기본값: 1, 최대: 5)')
            }),
            outputSchema: z.object({
                content: z
                    .array(
                        z.object({
                            type: z.literal('text'),
                            text: z.string().describe('좌표 결과')
                        })
                    )
                    .describe('좌표 결과')
            })
        },
        async ({ query, limit }) => {
            const url = new URL('https://nominatim.openstreetmap.org/search')
            url.searchParams.set('q', query)
            url.searchParams.set('format', 'json')
            url.searchParams.set('limit', String(limit))
    
            const res = await fetch(url.toString(), {
                headers: { 'User-Agent': 'my-mcp-server/1.0' }
            })
            const data = (await res.json()) as Array<{
                lat: string
                lon: string
                display_name: string
            }>
    
            if (data.length === 0) throw new Error('검색 결과가 없습니다.')
    
            const text = data
                .map(
                    (r, i) =>
                        `[${i + 1}] ${r.display_name}\n    위도: ${r.lat}, 경도: ${r.lon}`
                )
                .join('\n')
    
            return {
                content: [{ type: 'text' as const, text }],
                structuredContent: {
                    content: [{ type: 'text' as const, text }]
                }
            }
        }
    )
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 of behavioral disclosure. It successfully identifies the external dependency (Nominatim OpenStreetMap), hinting at network latency and rate limits, but lacks explicit details about error handling, what happens when addresses are not found, or idempotency.

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 a parenthetical data source attribution. It is appropriately front-loaded with no redundant or wasted text.

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 simple 2-parameter schema with 100% coverage and the presence of an output schema, the description is sufficiently complete for a straightforward geocoding tool. It identifies the return value type (coordinates) and data source, though it could benefit from mentioning error scenarios.

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 conceptually maps to the 'query' parameter (도시명 또는 주소) but adds no additional semantic guidance beyond the schema descriptions, such as address formatting tips or the significance of the 'limit' parameter.

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 converts city names or addresses into latitude/longitude coordinates using specific verbs (반환합니다) and identifies the resource (위도·경도 좌표). It distinguishes clearly from unrelated siblings like calc, generate-image, and greet.

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

Usage Guidelines3/5

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

While the unique name makes the purpose obvious among siblings, there is no explicit guidance on when to use this versus alternatives or prerequisites. For example, it doesn't mention whether to use this before get-weather when only a city name is available.

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/devbrother2024/my-mcp-server-260402'

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