Skip to main content
Glama

Outline objects (Segment Anything)

segment_objects

Trace precise object outlines from rough boxes or points with Segment Anything, then save them as polygon annotations for image labeling; supports medical images via MedSAM.

Instructions

Trace precise outlines with Segment Anything and add them as polygon annotations.

Give each object a rough box (or a point on it) in image pixels; the model finds the object's exact edges, so the box only has to contain the object. Prefer this to drawing polygons yourself. model: "sam" for photos and general images; "medsam" for medical images (CT, MRI, X-ray, ultrasound, endoscopy, pathology), which takes boxes only. Up to 20 objects per call. With save=false the outlines are returned without being saved. Each result has the model's quality score (0-1).

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": {
      "image_id": "<image_id>",
      "objects": "<objects>"
    },
    "name": "segment_objects"
  }
}

Input Schema

NameRequiredDescriptionDefault
saveNoSave the outlines as polygon annotations; false only returns them.
modelNo'sam' for everyday images; 'medsam' for medical images (CT, MRI, X-ray, ultrasound, endoscopy, pathology), which needs a box for every object.sam
objectsYesObjects to outline, each with a label and a rough box (x, y, width, height), a point on it, or both, in image pixels.
image_idYesId of an image in Image Label: the imageId (a UUID string) returned by list_images or an upload.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.9.0
    • changedInput schema / $defs / SegmentTarget / description
      Previous value: -"One object to outline: a rough box around it (best), or a point on it."New value: +"One object to outline: a rough box around it, a point on it, or both (most precise)."
    • changedInput schema / $defs / SegmentTarget / properties / point / description
      Previous value: -"A point on the object, when a box is hard to give"New value: +"A point on the object. With a box, it says which thing in the box is meant: use both for bands, structures between others, or objects at the image's edge (not with MedSAM)."
    • changedInput schema / properties / objects / description
      Previous value: -"Objects to outline, each with a label and a rough box (x, y, width, height) or a point on it, in image pixels."New value: +"Objects to outline, each with a label and a rough box (x, y, width, height), a point on it, or both, in image pixels."
  2. Changed4 schema fields changedv0.8.1
    • addedInput schema / properties / image_id / description
      Added value: +"Id of an image in Image Label: the imageId (a UUID string) returned by list_images or an upload."
    • addedInput schema / properties / model / description
      Added value: +"'sam' for everyday images; 'medsam' for medical images (CT, MRI, X-ray, ultrasound, endoscopy, pathology), which needs a box for every object."
    • addedInput schema / properties / objects / description
      Added value: +"Objects to outline, each with a label and a rough box (x, y, width, height) or a point on it, in image pixels."
    • addedInput schema / properties / save / description
      Added value: +"Save the outlines as polygon annotations; false only returns them."
  3. Addedv0.3.3

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only declare the mutation posture (readOnly=false, destructive=false, idempotent=false); the description supplies what they cannot: per-call object limit, the fact that save=false returns outlines without persisting, the medsam boxes-only constraint, and a per-result quality score (0-1). It does not warn that repeated calls with save=true will create duplicate annotations, which is a notable omission for a non-idempotent write tool.

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?

Front-loaded with the core action and the routing instruction in the first two sentences. Some information (model enum meanings, save behavior) is repeated almost verbatim from the schema descriptions, which is mild waste but not enough to hurt readability.

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 an output schema exists, the description needn't detail return values, yet it still flags the quality score. For a model-inference tool with four parameters and a mutation side effect, it covers scope, limits, model selection, and persistence behavior completely.

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 would be 3, but the description adds genuine meaning: the box "only has to contain the object," that a point disambiguates which object inside the box is meant, and what save=false does. It reinforces rather than merely restates the carefully written schema descriptions.

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?

Opens with a specific verb and resource ("Trace precise outlines with Segment Anything and add them as polygon annotations"), which clearly separates it from manual annotation tools like add_annotations and from detect_nuclei. An agent can identify the operation 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 Guidelines4/5

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

Gives a strong directive ("Prefer this to drawing polygons yourself") plus explicit model routing: "sam" for photos and general images, "medsam" for an enumerated list of medical modalities. It also states the 20-object cap and the save=false escape hatch. It never names a sibling tool explicitly or says when not to use this, so it falls short of full 5-level alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.