Skip to main content

annotools

Let agents see and annotate multimodal data within a token budget.

CI Coverage Python License Docs

Documentation · 中文

Source image, downscaled preview, grid overlay, box overlay, coordinates normalized to the source

Feeding full-resolution media to a multimodal model is expensive and imprecise. annotools gives an agent purpose-built views instead — downscaled previews, crop-zoom, grid guide lines, and overlays of boxes, keypoints, polygons and segmentation masks so it can check its own annotations before committing them. Every coordinate stays in one convention: normalized 0.0–1.0 relative to the uncropped source.

Two ways to use it

🔌 An MCP server for coding agents 📦 A library for agent developers
13 tools for Claude Code, Codex and OpenCode The same previews, overlays and conversions as functions
The agent looks at a dataset for a fraction of the context Give your own execution agent eyes, no MCP client needed
Preview size is a setting, so cost is tuned per model import annotools never loads fastmcp
→ Tool reference → API reference

Quick start

uv add "annotools[media] @ git+https://github.com/hoshiori-dev/annotools"

Pre-1.0: install from git. The first full release publishes to PyPI; every release also goes to TestPyPI, which rehearses the publishing path and is not an install channel. The media extra adds PyAV, which the video and audio tools need; drop it for images only.

As an MCP server

Register the annotools command over stdio. For Claude Code, .mcp.json:

{
  "mcpServers": {
    "annotools": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "annotools"],
      "env": { "ANNOTOOLS_MAX_WIDTH": "768", "ANNOTOOLS_MAX_HEIGHT": "768" }
    }
  }
}

Set the preview size for the model behind the agent: 384 px (the default) keeps a Gemini image at one 258-token unit, while Claude and GPT bill by area and read 768 px comfortably. Codex and OpenCode shapes, every setting, and the HTTP transport are in Register the server.

As a library

from annotools import BBoxObject, draw_bboxes, encode, load_image, normalize_coordinates, preview

result = preview(load_image("photo.jpg"), max_width=768, max_height=768)
boxes = normalize_coordinates(
    [[240, 130, 470, 505]],
    result.metadata["output_width"],
    result.metadata["output_height"],
)
overlay = draw_bboxes(result, [BBoxObject(bbox=boxes[0], label="cat")])
jpeg = encode(overlay.image, "jpeg")

Tools

Tool What it does
preview_image crop + downscale to fit the size limits
preview_image_grid preview with a semi-transparent grid to anchor positions
preview_image_bboxes box overlays from normalized coordinates, optional labels
preview_image_keypoints keypoint overlays from normalized coordinates, optional labels
preview_image_polygons polygon overlays with numbered vertices
preview_image_segmentation ID-mask overlay with per-region labels or a legend
preview_video frame sampling at N fps → one preview per frame
preview_video_grid frame sampling at N fps → a grid on every frame
clip_audio cut and resample audio to WAV
color_from_text stable color from any text
rotated_bbox_to_polygon (cx, cy, w, h, θ) → DOTA 8-number corners
normalize_coordinates a model's frame (pixels, or 0–1000) → normalized 0–1
denormalize_coordinates normalized 0–1 → a model's frame

Parameters, return shapes and specifications: tool reference.

Documentation

  • Get started — install, extras, container, MCP registration.
  • Usage — settings, coordinate conventions, the shape of a library call.
  • API reference — every public function, generated from its docstring.
  • Architecture — layers and recorded decisions.
  • skills/ — the annotation methodology, installable into your agent: npx skills add hoshiori-dev/annotools.
  • examples/ — four complete pipelines: captioning and detection, on the Claude Agent SDK and the Codex SDK.

Development

uv sync --all-extras
just check
just docker-build && just test-container

just check runs lint, format, types, taxonomy, README sync, the public-API docstring check, the generated-reference drift check, a strict docs build, and the tests behind a 95% coverage gate. See CONTRIBUTING.md; agents start from AGENTS.md.

License

Apache-2.0

Release files for annotools 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for annotools 0.1.0
File Size Uploaded
annotools-0.1.0.tar.gz 35.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for annotools 0.1.0
File Interpreter ABI Platform
annotools-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 82.5 kB

Release files / annotools-0.1.0.tar.gz

Download URL annotools-0.1.0.tar.gz
Size 35.6 kB
Tags Source
SHA-256 checksum
How to use checksums
669b91bd260e3ccd78ca724e8f7f3546ba52ab800ae98acae5a7e78450489038
BLAKE2b-256 checksum
How to use checksums
ff64adee05c6314031d1d01bab7176b71e8da118a1693da4a3d80ee9d05557e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / annotools-0.1.0-py3-none-any.whl

Download URL annotools-0.1.0-py3-none-any.whl
Size 46.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f80d92a6e99ea4c6ece4c9f32610fbea998fb77b44c6ab0697af843813ece7d
BLAKE2b-256 checksum
How to use checksums
f76c55918daa053406fe125e58c3cfc6b37dbb2326d657eb106c9654a3f8bbbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page