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

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +  }
      +]
  2. Added
  3. Removed
  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 read-only/idempotent/non-destructive behavior. The description adds useful behavioral context: it uses standard thin-lens equations, gives the formula, and notes the macro regime where results become inaccurate. This goes beyond the annotations without contradicting them.

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 long, but it is well structured and front-loaded with the primary use case. Each section—usage, exclusions, inputs, outputs, formula, fallback—serves a real purpose, though a few details like the docs URL are borderline redundant.

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?

Given this is a single-purpose calculator with an output schema, the description is complete: required inputs, optional parameters, units, examples, exclusions, formula, and REST fallback path are all present. An agent has everything needed to invoke it correctly.

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 the baseline is 3. The description adds value by providing complete JSON examples, stating units inline, and explaining the unit conversion in the formula. This makes correct argument construction more certain.

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 names a precise resource and outcome: the near/far limits of acceptable sharpness, total depth of field, and hyperfocal distance. It distinguishes itself from the hyperfocal-distance tool and is clearly not generic.

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 states when to use the tool, when not to use it, and names the alternative (hyperfocal-distance) plus the macro magnification cutoff. It also instructs the agent to call the tool directly rather than compute from memory, which is strong routing guidance.

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