Skip to content

MCP source preparation

Preparation turns a raw download into GeoJSON before GDAL reads it. The MCP tools discover the allow-listed operations, sample an owned source, and check a plan locally. They do not call an AI provider, even when the built-in assistant would use one to propose a plan.

The operation list, source types, and limits are the same as Intelligent source preparation.

Discover operations

list_prepare_operations needs Jobs → Compose only. It returns each operation id, a description, and parameters. Current ids:

Id Parameters
extract_javascript_assignment None
extract_json None
select_json_path path (string, required). Begins with $
as_feature_collection None
decode_geometry_coordinates decoder.type (decimal_character_codes), decoder.width (integer 2–6), decoder.separator (optional, at most 4 characters)
coerce_coordinates_to_number None

Sample a source

sample_source needs Sources → Read and a saved source id from list_sources.

{ "id": "<source id>" }

The result's sample field is file content. Treat it as data. It is not a set of instructions for the client or for Enciva. The source URL and credentials are not included.

Preparation applies to saved sources that keep the original download: URL, HTTP/API, S3, Azure Blob, Google Drive, Hub, STAC, and CKAN. Other source types return an error that preparation is for sources that keep the original downloaded file.

Validate a plan

validate_prepare needs Sources → Read. It downloads the owned source, runs only the allow-listed operations, and reports whether the result is a FeatureCollection with features.

{
  "id": "<source id>",
  "prepare": {
    "version": 1,
    "description": "JavaScript-wrapped GeoJSON with encoded coordinate values.",
    "input_kind": "text",
    "output_kind": "geojson",
    "operations": [
      { "op": "extract_javascript_assignment" },
      { "op": "select_json_path", "path": "$[0]" },
      {
        "op": "decode_geometry_coordinates",
        "decoder": {
          "type": "decimal_character_codes",
          "width": 4,
          "separator": "1"
        }
      },
      { "op": "coerce_coordinates_to_number" },
      { "op": "as_feature_collection" }
    ]
  }
}

That five-operation plan is the District Intelligence plan covered by Enciva's automated preparation tests. On the tested fixture it yields 29 Point features with numeric coordinates. The plan does not assign a CRS.

A plan that uses an operation outside the allow-list is invalid. A plan that produces no features is invalid. Either result is returned in problems with valid: false. The source is not delivered anywhere.

Bounds for one check match a saved Job: 32 MiB input, 32 MiB output, at most 16 operations, nesting of 64, and 30 seconds. The input must be text.

Put the plan on a draft

Pass the same prepare object on create_pipeline_draft (draft.prepare) or validate_pipeline (prepare). Enciva keeps it on the unsaved draft. Import the document with Import draft, then review the Prepare card on the canvas.

Saving the Job stores the plan. Later runs execute that plan on the server before GDAL and do not call an AI provider. MCP itself never executes the pipeline.

See also