Skip to main content
Glama

Evaluate SDF

evaluate_sdf
Read-onlyIdempotent

Use this when you need to sample a signed-distance field at a point. Sample the signed distance from an in-script sdf.* field at a 3D point. Returns { distance, inside, aabb, kind }. Distance is in mm; negative = inside the surface, 0 = exactly on the surface, positive = outside. Use this to verify SDF composition before calling sdf.materialize (which is the expensive step). The script must bind the SdfField via sdf.bind('', field) and pass that name as fieldName. Hint: pass either { file } or { code }, plus { fieldName, point: [x,y,z] }.

Input Schema

NameRequiredDescriptionDefault
codeNoInline kernelCAD script source.
fileNoPath to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.
pointYesSample point [x, y, z] in mm.
fieldNameYessdf.bind binding name holding the SdfField.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "aabb": {
      -    "additionalProperties": true,
      -    "description": "Axis-aligned bounding box of the field (success).",
      -    "type": "object"
      -  },
      -  "distance": {
      -    "description": "Signed distance in mm; negative = inside (success).",
      -    "type": "number"
      -  },
      -  "error": {
      -    "type": "string"
      -  },
      -  "errorCode": {
      -    "type": "string"
      -  },
      -  "hint": {
      -    "type": "string"
      -  },
      -  "inside": {
      -    "description": "Whether the point is inside the surface (success).",
      -    "type": "boolean"
      -  },
      -  "kind": {
      -    "description": "SDF field kind (success).",
      -    "type": "string"
      -  },
      -  "ok": {
      -    "type": "boolean"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok"
      -]
  2. Changed1 schema field changed
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .kcad.ts script file."New value: +"Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "aabb": {
      +      "additionalProperties": true,
      +      "description": "Axis-aligned bounding box of the field (success).",
      +      "type": "object"
      +    },
      +    "distance": {
      +      "description": "Signed distance in mm; negative = inside (success).",
      +      "type": "number"
      +    },
      +    "error": {
      +      "type": "string"
      +    },
      +    "errorCode": {
      +      "type": "string"
      +    },
      +    "hint": {
      +      "type": "string"
      +    },
      +    "inside": {
      +      "description": "Whether the point is inside the surface (success).",
      +      "type": "boolean"
      +    },
      +    "kind": {
      +      "description": "SDF field kind (success).",
      +      "type": "string"
      +    },
      +    "ok": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "ok"
      +  ],
      +  "type": "object"
      +}
  4. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, idempotent, non-destructive), and the description adds genuinely new context: units in mm and the sign convention (negative = inside, 0 = on surface, positive = outside). It restates the return shape '{ distance, inside, aabb, kind }', which the output schema already provides, so it stops just short of full marks.

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?

Front-loaded with the trigger and the core action, then units and sign semantics, then the materialize alternative, then the binding prerequisite. Dense and useful, though the explicit return-shape listing mildly duplicates the output schema.

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?

Complete for a read-only sampling tool: the agent knows when to call it, what to pass (including the file-vs-code choice), the prerequisite binding, the units/sign meaning, and what it is a cheap check for before an expensive operation.

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 baseline is 3, but the description adds meaning beyond the schema: it explains that fieldName must correspond to a sdf.bind binding and that the caller passes either { file } or { code } plus fieldName and point. That is real invocation guidance the schema alone does not tie together.

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?

States a specific verb (sample the signed distance) and resource (an sdf.* field) at a 3D point, and even names the return payload. An agent can distinguish this from the many add_*/inspect siblings without opening the schema.

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?

Explicitly conditions use ('use this when you need to sample... at a point') and names the alternative step it precedes: verifying SDF composition before the expensive sdf.materialize. It also states the prerequisite that the script must bind the field via sdf.bind('<name>', field).

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.