Skip to main content
Glama
Hydrata MCP Server

Hydrata MCP Server

Official
by Hydrata

Write a project input layer from GeoJSON

write_input_layer

Write a project input layer (boundary, friction, inflow, rainfall, building, mesh_region or culvert) from GeoJSON you send in this call.

Instructions

Write a project input layer (boundary, friction, inflow, rainfall, building, mesh_region or culvert) from GeoJSON you send in this call.

ASK FIRST: before you write any input, ask the person which approach they want (rain-on-grid, or an inflow hydrograph at a place they name), whether by 'hydrograph' they mean an inflow that drives the model or the flow they want out of the results, and for their design rainfall and losses; do not choose or source these yourself unless they ask you to.

No file, no key, no upload: the features go in features. Hydrata converts them into the project's grid and puts them in the project's default layer of that kind. Unlike attach_input_layer there is nothing to poll.

VARIANTS: the default row may feed scenarios that already ran, and writing it changes what they point at. For a variant (a copy of a scenario with different rainfall, say) write a SEPARATE row with target set to a title, then attach it to the copy with update_scenario or clone_scenario. A no-target write to a default row that a scenario with a built or complete run uses is refused, naming those scenarios, unless the person agreed and you pass replace_shared=true.

READ FIRST with read_input_layer. When the layer holds features a person drew, this tool ADDS yours beside them (mode 'append', the default; their feature ids hold). A replace (mode 'replace') writes a new layer and unlinks the old one, so it is refused unless the person agreed and you pass replace_existing=true; the refusal says how many of their features it would remove. Ask them before you replace.

Every feature must be the kind's geometry (lines for boundary, inflow and culvert; polygons for friction, rainfall, building and mesh_region); a feature of another geometry refuses the whole write and nothing changes. A culvert is one two-point line per culvert, Inlet first, then Outlet; its attributes are the culvert fields (name, shape, width_m, ... see the culvert guidance), nothing is renamed for you.

Limit: about 150 KB of GeoJSON (a few thousand vertices). A bigger layer is refused before anything is sent: ask the person to upload it in their browser with a request_input_upload link instead.

The layer is marked as written by your agent key and is UNREVIEWED until the user reviews it in their browser. INFLOWS: never invent an inflow location; take it from the study's files or give the user the ui_url to draw it.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "project_id": "<project_id>",
      "kind": "<kind>",
      "features": "<features>"
    },
    "name": "write_input_layer"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindYesWhich input this is: boundary, friction, inflow, rainfall, building, mesh_region or culvert ('structure' is a deprecated alias of building).
modeNo'append' adds `features` to the layer's existing features (the person's keep their ids); 'replace' writes a new layer. Leave empty: Hydrata appends when the layer holds features a person drew, and replaces otherwise.
methodNoOne short phrase saying how you made these features (e.g. 'traced from the council PDF', 'digitised from the survey CSV'). Shown to the person who reviews the layer.
targetNoWhich input row to write: an existing row id of this kind (list_inputs), or a TITLE for a NEW row of this kind (e.g. 'Rainfall - no losses'). Leave empty to write the project's default row. A new row is attached to no scenario until you attach it with update_scenario.
sourcesNoThe documents this came from, so the engineer can click through to them: a list of {title, url, locator}, e.g. [{title: 'GHD 2015 Sullivans Creek Flood Study', url: 'https://...', locator: 'Table 5-2'}]. Limits: title (1-200 characters) and url (http or https, at most 2000 characters) are required; locator (a page or table, e.g. 'p. 42' or 'Table 5-2') is optional, at most 100 characters. At most 20 entries. Pass it beside the method whenever you cite a document.
featuresYesA GeoJSON FeatureCollection with every feature of this kind. Coordinates are read as EPSG:4326 (lon/lat) unless the collection declares a `crs` member; Hydrata converts them into the project's grid. Multi* geometries are split into single ones.
project_idYesThe project ID
replace_sharedNoOnly true after the person agreed to change a default row that scenarios with a built or complete run use. Without it that write is refused and the refusal names those scenarios.
replace_existingNoOnly true after the person agreed to a replace that removes the features they drew. Without it a replace of a layer holding their features is refused and the refusal says how many.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.2.2
    • addedInput schema / properties / mode
      Added value: +{
      +  "default": "",
      +  "description": "'append' adds `features` to the layer's existing features (the person's keep their ids); 'replace' writes a new layer. Leave empty: Hydrata appends when the layer holds features a person drew, and replaces otherwise.",
      +  "type": "string"
      +}
    • addedInput schema / properties / replace_existing
      Added value: +{
      +  "default": false,
      +  "description": "Only true after the person agreed to a replace that removes the features they drew. Without it a replace of a layer holding their features is refused and the refusal says how many.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / replace_shared
      Added value: +{
      +  "default": false,
      +  "description": "Only true after the person agreed to change a default row that scenarios with a built or complete run use. Without it that write is refused and the refusal names those scenarios.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / sources
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "The documents this came from, so the engineer can click through to them: a list of {title, url, locator}, e.g. [{title: 'GHD 2015 Sullivans Creek Flood Study', url: 'https://...', locator: 'Table 5-2'}]. Limits: title (1-200 characters) and url (http or https, at most 2000 characters) are required; locator (a page or table, e.g. 'p. 42' or 'Table 5-2') is optional, at most 100 characters. At most 20 entries. Pass it beside the method whenever you cite a document."
      +}
    • addedInput schema / properties / target
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Which input row to write: an existing row id of this kind (list_inputs), or a TITLE for a NEW row of this kind (e.g. 'Rainfall - no losses'). Leave empty to write the project's default row. A new row is attached to no scenario until you attach it with update_scenario."
      +}
  2. Addedv0.2.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes far beyond the annotations: atomic all-or-nothing writes on geometry mismatch, append-vs-replace semantics ('their feature ids hold'), refusal messages that name affected scenarios or count removed features, the ~150 KB limit, the UNREVIEWED marking tied to the agent key, and the consent flags replace_shared/replace_existing. It notes that replace 'writes a new layer and unlinks the old one' — mild tension with destructiveHint=false, but the behaviour is gated behind explicit consent flags, so this reads as guarded destruction rather than a contradiction.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense but well organised, with front-loaded headers (ASK FIRST, VARIANTS, READ FIRST, Limit, INFLOWS) that let an agent scan to the relevant constraint. Some redundancy between the narrative and the schema descriptions (mode and replace_existing are stated twice near-verbatim), which is the main thing keeping it from a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a nine-parameter write tool with a nested FeatureCollection and an output schema, the description covers everything an agent needs: prerequisites (ask the user, read the layer first), coordinate handling, geometry validation, failure modes, consent gates, and the escalation path for oversized inputs. Nothing material about calling it correctly is left to inference.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description earns more by adding policy the schema doesn't carry — what `target` means for variants ('a copy of a scenario with different rainfall'), what triggers the replace_shared refusal, and the per-kind geometry rule plus the culvert Inlet/Outlet attribute convention. It duplicates some schema text (mode, replace_existing) rather than adding to it, which keeps it off a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource (write a project input layer) and enumerates exactly which kinds apply (boundary, friction, inflow, rainfall, building, mesh_region, culvert). It explicitly distinguishes itself from attach_input_layer ('nothing to poll') and route the user to request_input_upload for oversized layers, so an agent can separate this from its nearest siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use ('READ FIRST with read_input_layer'), an explicit ASK FIRST gate before writing anything, and explicit routing for the size-limit case (request_input_upload in the browser). It also spells out the variant workflow (separate row via `target`, then attach with update_scenario/clone_scenario) versus the default-row case, which is exactly the when/when-not discrimination an agent needs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.