Skip to main content
Glama

Depth of Field Calculator

calculate_depth_of_field
Read-onlyIdempotent

Use this when you need to know how much of a scene is acceptably sharp for given camera settings, or how far sharpness extends in front of and behind the focused subject. Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery.

Do not use this when you only need the focus distance that maximises depth of field (use hyperfocal-distance), or you shoot macro above about 0.2× magnification where lens extension and pupil magnification make the thin-lens equations inaccurate. What it computes: Computes the near and far limits of acceptable sharpness, the total depth of field and the hyperfocal distance from focal length, f-number, focus distance and the sensor's circle of confusion, using the standard thin-lens depth-of-field equations. Inputs: focal_length_mm (number, mm); aperture_f (number); focus_distance_m (number, m); sensor (enum, optional); coc_mm (number, mm, optional). Complete JSON argument examples: {"focal_length_mm":50,"aperture_f":2.8,"focus_distance_m":3,"sensor":"full_frame"} | {"focal_length_mm":24,"aperture_f":8,"focus_distance_m":5,"sensor":"full_frame"} Outputs: hyperfocal_m [m], near_limit_m [m], far_limit_m [m], far_limit_text, total_dof_m [m], in_front_of_subject_m [m], behind_subject_m [m], coc_used_mm [mm]. Formula: H = f² / (N·c) + f; near = s·(H − f) / (H + s − 2f); far = s·(H − f) / (H − s) when s < H, otherwise infinity (f = focal_length_mm, N = aperture_f, c = coc_mm, s = focus_distance_m × 1000, all in mm) Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/depth-of-field with the same JSON input fields. Do not guess another /api/* path. Docs: https://tttkmbb.com/photography/depth-of-field.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coc_mmNoOptional acceptable circle-of-confusion diameter; overrides the preset value (full frame 0.030, APS-C 0.020, Micro Four Thirds 0.015, 1-inch 0.011 mm). Unit: mm.
sensorNoSensor format; selects the circle of confusion (0.030 mm full frame, 0.020 mm APS-C, 0.015 mm Micro Four Thirds ...).full_frame
aperture_fYesLens f-number, e.g. 2.8 for f/2.8.
focal_length_mmYesActual (not equivalent) focal length of the lens in millimetres. Unit: mm.
focus_distance_mYesDistance from the camera's sensor plane to the focused subject in metres. Unit: m.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
linksNo
resultYes
requestYes
sourcesNo
successYes
versionNo
freshnessNo
timestampYes
next_actionsNo
service_versionYesDeployed Calcgrid implementation version used for the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedOutput schema / properties / service_version
      Added value: +{
      +  "description": "Deployed Calcgrid implementation version used for the result.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "success",
      -  "request",
      -  "result",
      -  "timestamp"
      -]New value: +[
      +  "success",
      +  "service_version",
      +  "request",
      +  "result",
      +  "timestamp"
      +]
  2. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "aperture_f": 2.8,
      +    "focal_length_mm": 50,
      +    "focus_distance_m": 3,
      +    "sensor": "full_frame"
      +  },
      +  {
      +    "aperture_f": 8,
      +    "focal_length_mm": 24,
      +    "focus_distance_m": 5,
      +    "sensor": "full_frame"
      +  }
      +]
  3. Added
  4. Removed
  5. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and idempotentHint, so the safety profile is covered. The description adds valuable behavioral context: it uses standard thin-lens equations, becomes inaccurate at macro magnifications, and can return infinity for the far limit. No contradiction with 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 well-structured with clear sections and front-loads usage guidance. It is lengthy, and the JSON examples partly duplicate schema examples, but the formula, output list, and REST fallback all carry useful information.

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?

For a calculator with a rich output schema, complete parameter schema, and full annotations, the description covers when to use it, what it computes, inputs, outputs, formula behavior, and a REST fallback. Edge cases like hyperfocal infinity are also noted, so nothing essential is missing.

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

Parameters3/5

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

Schema coverage is 100%, with units, ranges, defaults, and enums already documented for all parameters. The description lists the inputs and marks which are optional, but adds little meaning beyond the schema, so the baseline score is appropriate.

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?

The description states a specific verb ('computes') and names the exact outputs: near/far limits, total depth of field, and hyperfocal distance. This clearly distinguishes it from the many generic calculate_* sibling tools.

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?

It explicitly says 'Use this when...' and 'Do not use this when...', giving concrete conditions and naming an alternative calculator (hyperfocal-distance). This leaves no ambiguity about when to invoke this tool versus another.

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.

Resources