annotools.config¶
Defaults for every preview, grid, and overlay call. Library functions read these at call time whenever
a parameter is None; the MCP server resolves them once at start-up so its tool schemas advertise
concrete values.
config ¶
Project-wide defaults, resolved once from CLI arguments, ANNOTOOLS_* environment variables, and code.
OutputFormat
module-attribute
¶
Encodings a preview can be returned in.
GridMode
module-attribute
¶
ratio: a fixed number of equal cells; fixed: cells of a given pixel size.
Settings ¶
Bases: BaseSettings
Process-wide defaults for previews, grids, overlays, and encoding.
One object serves both audiences: the annotools command resolves it once from flags and
ANNOTOOLS_* variables and bakes the values into the MCP tool schemas; library callers read it
through get_settings at call time, so every None parameter falls back to these
values.
Precedence: annotools command-line flags (--max-width), then ANNOTOOLS_<FIELD>
environment variables (ANNOTOOLS_MAX_WIDTH), then the field defaults. Empty environment values
are ignored; invalid values raise a pydantic.ValidationError naming the field.
Examples:
References
- Spec:
.agents/knowledge/spec/mcp-overview.md(annotools repository), settings table. - 384 px default: Gemini bills an image up to 384x384 as one 258-token unit,
https://ai.google.dev/gemini-api/docs/image-understanding (verified 2026-08-27); Claude and
GPT bill by area, so pass 768+ for them (
skills/mllm-multimodal-input).
get_settings ¶
Return the process-wide Settings, resolving them from the environment on first use.
Library functions call this whenever a parameter is None; the result is cached until
configure or reset_settings replaces it.
Returns:
| Type | Description |
|---|---|
Settings
|
The active settings object (shared, not a copy). |
Examples:
Source code in src/annotools/config.py
configure ¶
Replace the process-wide settings.
Library functions read get_settings at call time, so the new values apply to every later
call. The MCP tool schemas snapshot the settings when annotools.mcp.server is first imported;
call this before that import (as annotools.mcp.cli does) to change the defaults the server
advertises.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Settings
|
The settings to install, typically built from flags or code. |
required |
Examples:
>>> from annotools import Settings, configure, get_settings, reset_settings
>>> configure(Settings(max_width=200))
>>> get_settings().max_width
200
>>> reset_settings()
Source code in src/annotools/config.py
reset_settings ¶
Forget the resolved settings so the next get_settings reads the environment again.
Meant for tests and interactive sessions; production code calls configure instead.
Examples:
>>> from annotools import Settings, configure, get_settings, reset_settings
>>> configure(Settings(max_width=200))
>>> reset_settings()
>>> get_settings().max_width
384