Skip to main content
Glama

Optics Raytrace

optics_raytrace
Read-only

Ray-trace light rays through a dielectric optical model to compute refraction, Fresnel/TIR energy splits, efficiency, and exit-angle distributions without needing FreeCAD geometry.

Instructions

Ray-trace a bundle through a dielectric optical model with rayoptics (asynchronous-free; needs no FreeCAD geometry). Requires the rayoptics wheel (the optics extra); when it does not resolve this returns {ok:false, reason, install} rather than raising. The geometric refraction comes from rayoptics; the Fresnel/TIR energy split + the exit histogram come from the exact analysis/optics core, so the trace is gated against that oracle (oracle_max_dev_deg = max rayoptics−Snell exit-angle deviation, ~0).

n_refractive is the medium index n2 (default PMMA 1.49062). source_config is {kind:'collimated'(angle_deg)|'cone'(half_angle_deg)|'lambertian' (max_angle_deg)} (default collimated at normal incidence). model may carry {n1 (incident index, default air 1.0), absorption (0..1 bulk loss), target_half_angle_deg (the acceptance cone counted as efficiency)}.

Returns the degradation dict, or {ok, backend:'rayoptics', rayoptics_version, n_rays, n1, n2, critical_angle_deg, efficiency, leakage_fraction, absorbed_fraction, tir_fraction, energy_balance, oracle_max_dev_deg, exit_distribution:[{angle_deg,intensity}], hotspot_locations}.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "optics_raytrace"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNo
n_raysNo
workspaceNoRun this call in this named workspace
n_refractiveNo
source_configNo

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

A3.9/5.0
Behavior4/5

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

Annotations already mark this as read-only and closed-world, and the description adds meaningful behavior: dependency handling, non-raising failure with {ok:false, reason, install}, oracle gating, and return fields. It does not fully cover performance or limits, but adds substantial context beyond 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?

The description is front-loaded and organized around purpose, parameters, and returns. It is dense but appropriate for a complex optical simulation tool, with little tangential material.

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?

With no output schema and low schema description coverage, the description compensates well by explaining the failure fallback and enumerating returned fields such as efficiency, leakage_fraction, oracle_max_dev_deg, and exit_distribution. It is complete enough for an agent to call and interpret the tool.

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 description coverage is only 20%, so the description must carry parameter meaning, and it does explain key nested structures for source_config and model plus n_refractive. It leaves n_rays mostly implicit, though the workspace parameter is documented in the schema.

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?

The description gives a specific verb and resource: ray-trace a ray bundle through a dielectric optical model using rayoptics. It implicitly distinguishes itself from geometry-based siblings by stating it needs no FreeCAD geometry, though it does not name optics_solid_trace explicitly.

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

Usage Guidelines3/5

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

It supplies useful usage context, including the rayoptics dependency, fallback behavior when unavailable, and default source setup. However, it never explicitly says when to choose this tool over optics_solid_trace, optics_lens_design, or optics_lens_optimize.

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