Skip to main content
Glama

Optics Solid Trace

optics_solid_trace
Read-only

Trace non-sequential rays through solid STL optical parts with a refractive index to compute exit directions, bend angles, and optional surface paths for light-pipe, prism, and lens analysis.

Instructions

NON-SEQUENTIAL ray trace through a real solid (STL mesh) with a refractive index — the lane for molded optical parts (light-pipes, prisms, lenses). Backed by KrakenOS, which is GPL-3.0 and is run ONLY in a subprocess (the parent never imports it — same arm's-length isolation as the GPL Elmer/OpenFOAM binaries). Requires the optics_gpl extra; degrades to {ok:false, reason, install} otherwise.

Geometry: pass a model handle (exported to STL here) OR a ready stl_path. Material: glass (KrakenOS catalog name, e.g. 'BK7') or n_refractive (constant index). rays: [{origin:[x,y,z], dir:[l,m,n]}]; each ray's turn_deg is its input->exit bend (~90 for a TIR corner prism, ~0 for a straight pass). solid: {diameter, thickness, axis_move} placement. wavelength_um default 0.55. want_paths (default False): also return each valid ray's polyline as paths — the per-surface hit points [[x,y,z], ...] in the traced frame. The LAST point of each path is the ray's EXIT LOCATION on the solid, so the spatial exit/leakage map a diffuser needs can be reconstructed from it.

Returns the degradation dict, or {ok, backend:'KrakenOS (subprocess-isolated, GPL-3.0)', n_launched, n_valid, valid_fraction, mean_turn_deg, max_turn_deg, rays:[{valid, exit_dir, turn_deg}], stl_path, paths?:[[[x,y,z],...],...]}.

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": {
      "rays": "<rays>"
    },
    "name": "optics_solid_trace"
  }
}

Input Schema

NameRequiredDescriptionDefault
raysYes
glassNo
modelNo
solidNo
stl_pathNo
workspaceNoRun this call in this named workspace
want_pathsNo
n_refractiveNo
wavelength_umNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.7
    • addedInput schema / properties / workspace
      Added value: +{
      +  "default": "",
      +  "description": "Run this call in this named workspace",
      +  "title": "Workspace",
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Goes well past the readOnlyHint/openWorldHint annotations: discloses the GPL-3.0 KrakenOS backend, that it runs only in a subprocess with arm's-length isolation, the extra-dependency requirement, and the exact `{ok:false, reason, install}` failure shape. That is exactly the licensing/install/isolation context an agent cannot infer from annotations.

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 and organized into purpose, licensing, geometry/material/ray inputs, then returns — easy to scan. A few parentheticals (the Elmer/OpenFOAM isolation analogy) are more justification than the caller needs, but nothing is wasted outright.

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?

There is no output schema, and the description compensates fully by enumerating the return dict (`n_launched`, `n_valid`, `valid_fraction`, `mean_turn_deg`, per-ray `turn_deg`, optional `paths`). For a 9-parameter, dependency-gated simulation call, the agent has everything needed to invoke and interpret it.

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 description coverage is only 11% (and `rays` items are a bare `{}`), so the description must carry the load and does: ray element format `{origin:[x,y,z], dir:[l,m,n]}`, the model-handle-vs-`stl_path` alternative, `glass` as a KrakenOS catalog name vs constant `n_refractive`, `solid` sub-keys, and the 0.55 µm default. Only `workspace` is left to the schema, which already documents it.

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 and resource ('NON-SEQUENTIAL ray trace through a real solid (STL mesh) with a refractive index') and immediately scopes it to 'the lane for molded optical parts (light-pipes, prisms, lenses)', which separates it from the sequential lens-design siblings. The contrast with optics_raytrace/optics_lens_design is legible without opening either schema.

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?

Clear context for when to reach for it (molded solid parts with a refractive index, non-sequential propagation) plus a hard prerequisite: the `optics_gpl` extra, with stated degradation when absent. It never names the alternative tool explicitly (e.g. 'for sequential lens prescriptions use optics_lens_design'), so the routing is implied rather than spelled out.

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

Deploy Server

Other Tools