Skip to main content
Glama

Optics Lens Optimize

optics_lens_optimize
Read-only

Optimizes sequential optical systems by adjusting radii and thickness variables to meet merit-function targets, returning before/after focal length and spot-size metrics.

Instructions

Optimize a SEQUENTIAL optical system with optiland's optimizer (MIT, in-process) — the capability rayoptics lacks. Requires the optics extra; degrades to {ok:false, reason, install} otherwise.

surfaces: as in optics_lens_design. variables: [{type:'radius'|'thickness', surface:<1-based int>}] — the degrees of freedom. targets: [{operand:'f2'| 'rms_spot_size'|…, target, weight?, surface?}] — the merit function. maxiter caps iterations.

Returns the degradation dict, or {ok, backend:'optiland', converged, n_fev, before:{efl_mm,rss}, after:{efl_mm,rss}, surfaces:[optimized]}.

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": {
      "surfaces": "<surfaces>",
      "variables": "<variables>",
      "targets": "<targets>"
    },
    "name": "optics_lens_optimize"
  }
}

Input Schema

NameRequiredDescriptionDefault
epdNo
maxiterNo
targetsYes
surfacesYes
variablesYes
workspaceNoRun this call in this named workspace
wavelengths_umNo
field_angles_degNo

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.2/5.0
Behavior4/5

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

Beyond the readOnlyHint/openWorldHint annotations, it reveals the fallback failure shape, the backend identity, the convergence/n_fev signals, and the before/after metric comparison. It does not mention runtime cost or iteration-bound behavior for a potentially expensive optimization loop, which is the main remaining gap.

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

Conciseness5/5

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

The core purpose and the sequential-only constraint lead, followed by the prerequisite, then the parameter contract, then the return shape. Dense but every clause carries information an agent needs; no filler.

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?

There is no output schema, and the description compensates by spelling out the return dict keys including before/after efl_mm and rss. The only shortfall is the undocumented optional optical inputs, which matter for correct invocation but are partially inferable from the referenced optics_lens_design 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 coverage is only 13%, so the description must carry the load, and it does for the three required arrays: `variables` enumerated as radius/thickness keyed by 1-based surface, `targets` as operand/target/weight/surface, plus `maxiter`. It leaves `epd`, `wavelengths_um`, and `field_angles_deg` — optically significant inputs — undocumented in both places.

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 (optimize a sequential optical system) plus the engine used (optiland) and contrasts it with the sibling capability that lacks it (rayoptics). An agent can distinguish it from optics_lens_design and optics_raytrace 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 Guidelines3/5

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

It gives a hard precondition (requires the `optics` extra, otherwise degrades to {ok:false, reason, install}) and points to optics_lens_design for the `surfaces` format, which implies a design-then-optimize workflow. However it never explicitly says when to choose this over optics_lens_design or optics_raytrace, or what conditions make optimization inappropriate.

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