Skip to main content
Glama
ronantakizawa

GIS Data Conversion MCP

csv_to_geojson

Convert CSV files containing geographic coordinates into GeoJSON format for mapping and spatial analysis by specifying latitude and longitude fields.

Instructions

Convert CSV with geographic data to GeoJSON

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
csvYesCSV string to convert
latfieldYesField name for latitude
lonfieldYesField name for longitude
delimiterNoCSV delimiter (default is comma),

Implementation Reference

  • The handler function csvToGeoJSON that performs the CSV to GeoJSON conversion using the csv2geojson library. It takes CSV string, latitude and longitude field names, optional delimiter, validates inputs, calls the library's csv2geojson function, and returns formatted GeoJSON.
    async csvToGeoJSON(args: any): Promise<ToolResponse> {
      const { csv, latfield, lonfield, delimiter = ',' } = args;
    
      if (!csv || !latfield || !lonfield) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Missing required parameters: csv, latfield, lonfield'
        );
      }
    
      return new Promise<ToolResponse>((resolve, reject) => {
        try {
          console.error(`[Converting] CSV to GeoJSON using lat field ${latfield} and lon field ${lonfield}`);
          
          csv2geojson.csv2geojson(csv, {
            latfield,
            lonfield,
            delimiter
          }, (err: Error | null, data: any) => {
            if (err) {
              console.error('[Error] CSV to GeoJSON conversion failed:', err);
              reject(new McpError(
                ErrorCode.InternalError,
                `CSV to GeoJSON conversion failed: ${err.message}`
              ));
              return;
            }
            
            resolve(this.formatToolResponse(JSON.stringify(data, null, 2)));
          });
        } catch (error) {
          console.error('[Error] CSV to GeoJSON conversion failed:', error);
          reject(new McpError(
            ErrorCode.InternalError,
            `CSV to GeoJSON conversion failed: ${error instanceof Error ? error.message : String(error)}`
          ));
        }
      });
    }
  • Tool registration in listTools response including name, description, and inputSchema defining parameters: csv (string, required), latfield (string, required), lonfield (string, required), delimiter (string, optional default ',').
    name: 'csv_to_geojson',
    description: 'Convert CSV with geographic data to GeoJSON',
    inputSchema: {
      type: 'object',
      properties: {
        csv: {
          type: 'string',
          description: 'CSV string to convert',
        },
        latfield: {
          type: 'string',
          description: 'Field name for latitude',
        },
        lonfield: {
          type: 'string',
          description: 'Field name for longitude',
        },
        delimiter: {
          type: 'string',
          description: 'CSV delimiter (default is comma)',
          default: ',',
        },
      },
      required: ['csv', 'latfield', 'lonfield'],
  • src/index.ts:284-285 (registration)
    Dispatcher switch case in CallToolRequest handler that routes 'csv_to_geojson' calls to the csvToGeoJSON method.
    case 'csv_to_geojson':
      return await this.csvToGeoJSON(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 the full burden of behavioral disclosure. It states the conversion action but lacks details on error handling, output format specifics, performance considerations, or any side effects. This is a significant gap for a tool with no annotation coverage.

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—it directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded, 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 complexity of data conversion and lack of annotations or output schema, the description is incomplete. It doesn't explain the GeoJSON output structure, error cases, or how it interacts with sibling tools, leaving gaps that could hinder effective tool selection and invocation.

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 input schema already documents all parameters thoroughly. The description adds no additional meaning beyond implying geographic data conversion, which is covered by the schema's field descriptions. This meets the baseline for high schema coverage.

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 ('CSV with geographic data' to 'GeoJSON'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'geojson_to_csv' or 'kml_to_geojson', which handle related conversions but in opposite directions or between other formats.

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. It doesn't mention sibling tools like 'geojson_to_csv' for reverse conversions or 'wkt_to_geojson' for other geographic data formats, leaving the agent to infer usage context without explicit direction.

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