Skip to main content
Glama
ronantakizawa

GIS Data Conversion MCP

topojson_to_geojson

Convert TopoJSON to GeoJSON format for geographic data processing and visualization.

Instructions

Convert TopoJSON to GeoJSON format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topojsonYesTopoJSON object to convert
objectNameNoName of the TopoJSON object to convert (if not provided, first object is used)

Implementation Reference

  • The main execution logic for the 'topojson_to_geojson' tool. It validates input, determines the TopoJSON object to convert, and uses topojsonClient.feature to produce GeoJSON output.
    async topojsonToGeoJSON(args: any): Promise<ToolResponse> {
      const { topojson, objectName } = args;
      
      if (!topojson) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Missing required parameter: topojson'
        );
      }
      
      try {
        console.error('[Converting] TopoJSON to GeoJSON');
        
        // Determine which object to convert
        let objName = objectName;
        
        // If no object name provided, use the first object in the topology
        if (!objName && topojson.objects) {
          objName = Object.keys(topojson.objects)[0];
        }
        
        if (!objName || !topojson.objects || !topojson.objects[objName]) {
          throw new Error('No valid object found in TopoJSON');
        }
        
        // Convert TopoJSON to GeoJSON
        const geojson = topojsonClient.feature(topojson, topojson.objects[objName]);
        
        return this.formatToolResponse(JSON.stringify(geojson, null, 2));
      } catch (error) {
        console.error('[Error] TopoJSON to GeoJSON conversion failed:', error);
        throw new McpError(
          ErrorCode.InternalError,
          `TopoJSON to GeoJSON conversion failed: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • src/index.ts:189-206 (registration)
    Registration of the 'topojson_to_geojson' tool in the ListTools response, including name, description, and input schema definition.
    {
      name: 'topojson_to_geojson',
      description: 'Convert TopoJSON to GeoJSON format',
      inputSchema: {
        type: 'object',
        properties: {
          topojson: {
            type: 'object',
            description: 'TopoJSON object to convert',
          },
          objectName: {
            type: 'string',
            description: 'Name of the TopoJSON object to convert (if not provided, first object is used)',
          },
        },
        required: ['topojson'],
      },
    },
  • Input schema definition for the 'topojson_to_geojson' tool specifying required 'topojson' object and optional 'objectName'.
    inputSchema: {
      type: 'object',
      properties: {
        topojson: {
          type: 'object',
          description: 'TopoJSON object to convert',
        },
        objectName: {
          type: 'string',
          description: 'Name of the TopoJSON object to convert (if not provided, first object is used)',
        },
      },
      required: ['topojson'],
  • src/index.ts:290-291 (registration)
    Dispatch case in the CallToolRequest handler that routes to the topojsonToGeoJSON method.
    case 'topojson_to_geojson':
      return await this.topojsonToGeoJSON(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description carries full burden but only states the conversion action without behavioral details. It doesn't disclose error handling, performance implications, output structure, or any side effects, which is inadequate for a tool with nested objects and no output schema.

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, front-loading the core action ('Convert TopoJSON to GeoJSON format'). It's appropriately sized for a straightforward conversion tool, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's complexity (nested objects, no output schema) and lack of annotations, the description is incomplete. It doesn't explain the conversion process, output format, or potential issues, leaving gaps that could hinder correct tool invocation in a broader context.

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%, so the schema fully documents both parameters. The description adds no additional meaning beyond implying conversion, which aligns with the schema but doesn't compensate for gaps. Baseline 3 is appropriate as the schema handles parameter semantics effectively.

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

Purpose4/5

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

The description clearly states the tool's purpose with a specific verb ('Convert') and resources ('TopoJSON to GeoJSON format'), making it immediately understandable. However, it doesn't differentiate from sibling tools like 'geojson_to_topojson' or 'kml_to_geojson' that perform related but inverse or alternative conversions, missing explicit distinction.

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. With siblings like 'csv_to_geojson' and 'kml_to_geojson' available, there's no indication of context, prerequisites, or exclusions, leaving the agent to infer usage based on input format alone.

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/ronantakizawa/gis-dataconvertersion-mcp'

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