Skip to main content
Glama

geojson_to_wkt

Convert GeoJSON objects into Well-Known Text (WKT) format for streamlined GIS data processing and compatibility with spatial analysis tools.

Instructions

Convert GeoJSON to Well-Known Text (WKT) format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geojsonYesGeoJSON object to convert

Implementation Reference

  • The handler function that implements the geojson_to_wkt tool logic, converting GeoJSON to WKT using the wellknown.stringify method.
    async geoJSONToWKT(args: any): Promise<ToolResponse> { const { geojson } = args; if (!geojson) { throw new McpError( ErrorCode.InvalidParams, 'Missing required parameter: geojson' ); } try { console.error(`[Converting] GeoJSON to WKT: ${JSON.stringify(geojson).substring(0, 50)}...`); const wkt = wellknown.stringify(geojson); if (!wkt) { throw new Error('Failed to convert GeoJSON to WKT'); } return this.formatToolResponse(wkt); } catch (error) { console.error('[Error] GeoJSON to WKT conversion failed:', error); throw new McpError( ErrorCode.InternalError, `GeoJSON to WKT conversion failed: ${error instanceof Error ? error.message : String(error)}` ); }
  • src/index.ts:106-117 (registration)
    Tool registration in the ListTools response, defining the name, description, and input schema for geojson_to_wkt.
    name: 'geojson_to_wkt', description: 'Convert GeoJSON to Well-Known Text (WKT) format', inputSchema: { type: 'object', properties: { geojson: { type: 'object', description: 'GeoJSON object to convert', }, }, required: ['geojson'], },
  • The input schema definition for the geojson_to_wkt tool, specifying the expected geojson object parameter.
    inputSchema: { type: 'object', properties: { geojson: { type: 'object', description: 'GeoJSON object to convert', }, }, required: ['geojson'], },
  • Dispatch case in the CallToolRequest handler that routes to the geoJSONToWKT implementation.
    case 'geojson_to_wkt': return await this.geoJSONToWKT(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