Skip to main content
Glama
ronantakizawa

GIS Data Conversion MCP

kml_to_geojson

Convert KML geographic data to GeoJSON format for use in web mapping applications and GIS software. This tool transforms KML content into the widely supported GeoJSON standard.

Instructions

Convert KML to GeoJSON format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kmlYesKML content to convert

Implementation Reference

  • The handler function that validates input, parses the KML string into an XML document using DOMParser, converts it to GeoJSON using the imported kmlToGeoJSON function, and returns the formatted response.
    async kmlToGeoJSON(args: any): Promise<ToolResponse> {
      const { kml } = args;
      
      if (!kml) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Missing required parameter: kml'
        );
      }
      
      try {
        console.error('[Converting] KML to GeoJSON');
        
        // Parse KML string to XML DOM
        const parser = new DOMParser();
        const kmlDoc = parser.parseFromString(kml, 'text/xml');
        
        // Convert KML to GeoJSON
        const geojson = kmlToGeoJSON(kmlDoc);
        
        return this.formatToolResponse(JSON.stringify(geojson, null, 2));
      } catch (error) {
        console.error('[Error] KML to GeoJSON conversion failed:', error);
        throw new McpError(
          ErrorCode.InternalError,
          `KML to GeoJSON conversion failed: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Input schema definition for the kml_to_geojson tool, requiring a 'kml' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        kml: {
          type: 'string',
          description: 'KML content to convert',
        },
      },
      required: ['kml'],
    },
  • src/index.ts:292-293 (registration)
    Tool dispatcher registration that maps the 'kml_to_geojson' name to the kmlToGeoJSON handler method.
    case 'kml_to_geojson':
      return await this.kmlToGeoJSON(request.params.arguments);
  • src/index.ts:207-220 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    {
      name: 'kml_to_geojson',
      description: 'Convert KML to GeoJSON format',
      inputSchema: {
        type: 'object',
        properties: {
          kml: {
            type: 'string',
            description: 'KML content to convert',
          },
        },
        required: ['kml'],
      },
    },
  • Import of the core kml conversion function from the togeojson library, aliased as kmlToGeoJSON and used in the handler.
    import { kml as kmlToGeoJSON } from '@tmcw/togeojson';
Behavior2/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 mentions conversion but doesn't describe what happens during processing (e.g., error handling, validation, performance limits) or the output format details. This is a significant gap for a tool with mutation-like behavior (format transformation).

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 wasted words. It is front-loaded with the core purpose and appropriately sized for a straightforward conversion tool.

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 (format conversion with no annotations or output schema), the description is incomplete. It lacks details on output structure, error cases, or behavioral traits, leaving the agent with insufficient context for reliable use.

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?

The input schema has 100% description coverage, with the single parameter 'kml' documented as 'KML content to convert'. The description adds no additional meaning beyond this, such as format requirements or examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('KML to GeoJSON format'), making it immediately understandable. However, it doesn't differentiate from sibling tools like 'geojson_to_kml' or 'csv_to_geojson' beyond the input format, which prevents a perfect score.

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 like 'csv_to_geojson' or 'wkt_to_geojson', nor does it mention prerequisites or exclusions. It only states what the tool does, leaving usage context entirely implicit.

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