Skip to main content
Glama

geojson_to_kml

Convert GeoJSON files to KML format for geographic data visualization and integration, enabling precise format transformation with customizable document name, description, and property mapping.

Instructions

Convert GeoJSON to KML format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionPropertyNoProperty name in GeoJSON to use as KML descriptiondescription
documentDescriptionNoDescription for the KML documentConverted from GeoJSON by GIS Format Conversion MCP
documentNameNoName for the KML documentGeoJSON Conversion
geojsonYesGeoJSON object to convert
namePropertyNoProperty name in GeoJSON to use as KML namename

Implementation Reference

  • The handler function for geojson_to_kml tool. Validates input geojson, prepares options, calls tokml(geojson, options) to convert to KML, and returns ToolResponse.
    async geojsonToKML(args: any): Promise<ToolResponse> { const { geojson, documentName = 'GeoJSON Conversion', documentDescription = 'Converted from GeoJSON by GIS Format Conversion MCP', nameProperty = 'name', descriptionProperty = 'description' } = args; if (!geojson) { throw new McpError( ErrorCode.InvalidParams, 'Missing required parameter: geojson' ); } try { console.error('[Converting] GeoJSON to KML'); // Set up options for tokml const options = { documentName: documentName, documentDescription: documentDescription, name: nameProperty, description: descriptionProperty }; // Convert GeoJSON to KML using tokml const kml = tokml(geojson, options); return this.formatToolResponse(kml); } catch (error) { console.error('[Error] GeoJSON to KML conversion failed:', error); throw new McpError( ErrorCode.InternalError, `GeoJSON to KML conversion failed: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Input schema for the geojson_to_kml tool defining required geojson object and optional string parameters for KML document customization.
    inputSchema: { type: 'object', properties: { geojson: { type: 'object', description: 'GeoJSON object to convert', }, documentName: { type: 'string', description: 'Name for the KML document', default: 'GeoJSON Conversion', }, documentDescription: { type: 'string', description: 'Description for the KML document', default: 'Converted from GeoJSON by GIS Format Conversion MCP', }, nameProperty: { type: 'string', description: 'Property name in GeoJSON to use as KML name', default: 'name', }, descriptionProperty: { type: 'string', description: 'Property name in GeoJSON to use as KML description', default: 'description', } }, required: ['geojson'], },
  • src/index.ts:221-254 (registration)
    Registration of geojson_to_kml tool in the tools list returned by ListToolsRequestSchema handler.
    { name: 'geojson_to_kml', description: 'Convert GeoJSON to KML format', inputSchema: { type: 'object', properties: { geojson: { type: 'object', description: 'GeoJSON object to convert', }, documentName: { type: 'string', description: 'Name for the KML document', default: 'GeoJSON Conversion', }, documentDescription: { type: 'string', description: 'Description for the KML document', default: 'Converted from GeoJSON by GIS Format Conversion MCP', }, nameProperty: { type: 'string', description: 'Property name in GeoJSON to use as KML name', default: 'name', }, descriptionProperty: { type: 'string', description: 'Property name in GeoJSON to use as KML description', default: 'description', } }, required: ['geojson'], }, },
  • src/index.ts:294-295 (registration)
    Switch case in CallToolRequestSchema handler that dispatches geojson_to_kml calls to the geojsonToKML method.
    case 'geojson_to_kml': return await this.geojsonToKML(request.params.arguments);

Other Tools

Related 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