Skip to main content
Glama

sam2_refine_mask

Refine a PNG mask by applying erosion and Gaussian blur, reducing edge artifacts and smoothing boundaries for cleaner video compositing.

Instructions

Refine a PNG mask by erosion and Gaussian blur. Needs only OpenCV and NumPy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blurNo
inputYes
outputYes
erosionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses the operations (erosion, Gaussian blur) and the dependency requirement, but it doesn't state whether the input mask is modified in-place, whether the output file is overwritten, what happens with existing files, or any side effects. For a tool that writes an output file, this is a significant gap.

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 a single sentence, concise and front-loaded with the core action. The dependency note is useful but could be considered extra. No wasted words, though it could be slightly more informative without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters, 0% schema coverage, no annotations, and no output schema, the description is too thin. It doesn't explain parameter semantics, file format expectations, output behavior, or error conditions. An agent would struggle to know what values to pass for 'blur' and 'erosion' and what the tool returns.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'erosion and Gaussian blur' which maps to the 'erosion' and 'blur' parameters, but it doesn't explain the meaning of 'input' and 'output' beyond their names, nor the units/ranges of erosion and blur (e.g., kernel size, sigma). The description adds minimal value over the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('refine') and resource ('PNG mask') with the operations 'erosion and Gaussian blur'. It distinguishes itself from sibling SAM2 tools (segment, track, inpaint) by focusing on mask post-processing. However, it doesn't explicitly name a sibling alternative or contrast with other mask tools like sam2_propagate_mask.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

The description implies usage: it is for refining an existing PNG mask, not for creating or propagating masks. It doesn't explicitly state when to use this tool vs alternatives like sam2_propagate_mask or sam2_segment_image. The context of 'needs only OpenCV and NumPy' hints at a lightweight post-processing step, but no explicit when/when-not guidance is given.

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