Skip to main content
Glama

measure_polygon

Measure a closed polygon's area and perimeter at the sheet's scale, optionally as a deduction, to calculate room or takeoff quantities from plan coordinates.

Instructions

Measure a closed polygon you supply (min 3 vertices, image px): area_sf and perimeter_lf at the sheet's scale. Requires the scale to be set. Pass condition to commit it; role "deduct" subtracts. A room ring belongs on the innermost wall-face strokes from get_sheet_vectors, crossing each door opening on the wall centerline and wrapping columns and stubs; never on a hatch edge, casework or a door leaf. Check it with view_sheet overlay:true on a tight crop and fix it with edit_shape. A CURVED wall is a circle: do not chord it and do not hand-tessellate it — give the bow one point on the wall and list its index in arc_through. Coordinates are image px at render scale 2.0: PDF pt × 2, origin top-left, y down (the browser canvas's native space). Sheet payloads carry dims in both px and pt.

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": {
      "sheet": "<sheet>",
      "verts": "<verts>"
    },
    "name": "measure_polygon"
  }
}

Input Schema

NameRequiredDescriptionDefault
roleNofloor_area
sheetYes
vertsYes
conditionNo
arc_throughNoIndices of points that are the MIDDLE of an arc: the trace runs the point before → this point → the point after as the unique circle through the three (the canvas's Curve mode). For a curved wall put one point anywhere ON the bow between its two ends and mark it. The arc is baked to ordinary vertices on commit and origin.curved is stamped; a mark on an end of an open run, or two marks in a row, refuses.

Output Schema

NameRequiredDescriptionDefault
arcsNoHow many arc_through bows were laid — present only when the trace was bent; the vertices reported are the baked arc, not the three points you gave
nvertsYes
area_sfYes
warningNoMixed-scale warning (#153): a scale note disagreeing with the sheet's sits in the measured region — verify before trusting these numbers
shape_idNoPresent when condition was passed and the shape committed
perimeter_lfYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.1.31
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / arc_through / items / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / verts / items / additionalItems
      Added value: +false
    • addedOutput schema / properties / arcs / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / arcs / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / nverts / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / nverts / minimum
      Added value: +-9007199254740991
  2. Changed2 schema fields changedv0.1.24
    • addedInput schema / properties / arc_through
      Added value: +{
      +  "description": "Indices of points that are the MIDDLE of an arc: the trace runs the point before → this point → the point after as the unique circle through the three (the canvas's Curve mode). For a curved wall put one point anywhere ON the bow between its two ends and mark it. The arc is baked to ordinary vertices on commit and origin.curved is stamped; a mark on an end of an open run, or two marks in a row, refuses.",
      +  "items": {
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / arcs
      Added value: +{
      +  "description": "How many arc_through bows were laid — present only when the trace was bent; the vertices reported are the baked arc, not the three points you gave",
      +  "type": "integer"
      +}
  3. Changed1 schema field changedv0.1.9
    • addedOutput schema / properties / warning
      Added value: +{
      +  "description": "Mixed-scale warning (#153): a scale note disagreeing with the sheet's sits in the measured region — verify before trusting these numbers",
      +  "type": "string"
      +}
  4. Addedv0.1.2
  5. Removedv0.1.1
  6. First observed

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does substantial work: it discloses the scale prerequisite, that passing condition commits the result, that role "deduct" subtracts from floor area, that arcs are baked to ordinary vertices with origin.curved stamped, and the specific refusal cases (a mark on an end of an open run, or two marks in a row). It stops short of saying whether the measurement persists as a shape or what a failed call returns.

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?

Purpose and prerequisites are front-loaded in the first two sentences, and each later block addresses a distinct concern (ring tracing, verification loop, arcs, coordinate space). It is dense but not padded; the arc and coordinate paragraphs are long enough that an agent could lose the main instruction thread.

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

Completeness4/5

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

For a five-parameter mutation-adjacent tool with no annotations and a 20%-covered schema, the description supplies the missing prerequisites, role semantics, arc encoding, and coordinate system, and an output schema exists so return values need no explanation. The one real gap is whether a committed measurement becomes a persistent shape that edit_shape/delete_shape can then act on.

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

Parameters5/5

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

Schema coverage is only 20%, so the description must compensate and it does: verts is defined as image-px vertex pairs with a minimum of three, sheet is contextualized through the render-scale coordinate convention, role's "deduct" behavior is explained, condition is explained as the commit trigger, and arc_through is covered in both schema and prose. The coordinate-space paragraph (px at render scale 2.0, PDF pt × 2, origin top-left, y down) adds meaning no schema field conveys.

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?

States a specific verb and resource ("Measure a closed polygon you supply") and names the outputs produced (area_sf, perimeter_lf at the sheet's scale), plus the min-3-vertex constraint. The closed-polygon framing implicitly separates it from measure_line, but no sibling is named explicitly, so an agent still has to infer the boundary against measure_surface or cut_out.

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

Usage Guidelines4/5

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

Gives a hard prerequisite ("Requires the scale to be set") and downstream routing to view_sheet overlay:true for verification and edit_shape for correction. The tracing rules for room rings (innermost wall-face strokes, crossing door openings on the centerline, never on hatch edges, casework, or door leaves) are concrete usage conditions. It does not, however, say when to prefer this over measure_surface or cut_out.

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