Skip to main content
Glama

ass_set_tag

Insert or update a single ASS override tag on a subtitle line or selected lines, controlling placement and skipping existing tags.

Instructions

Insert (or update) a single override tag on a line or a selection.

Args: selection: selection spelling; when given, text/index must be omitted and every selected line is processed. index / text / doc_id: single-line source (0-based index inside doc_id, or a raw string). name: tag name without the backslash, e.g. "fad", "an", "pos", "fscx" or "1c". A leading backslash is allowed. arg: the tag argument, e.g. "200,200" for \fad(200,200) or "8" for \an8. Parentheses are added automatically when the argument needs them. Braces and line breaks are rejected, and so is an out-of-range alignment for \an (1..9) or legacy \a (1..11) — those are ignored by libass when wrong, so they are caught here instead. value: alias for arg; when not None it wins (handy for numeric callers, e.g. value=8). doc_id: document for index/selection. where: where to put the tag. "prepend" merges the tag into a new leading block (the line's existing first block is reused so that repeated tags are updated rather than duplicated); "after_first_block" (default) appends the tag to the end of the line's first override block, creating that block when the line has none; "prepend_block" always inserts a brand new leading block; "append" adds a block at the very end of the line; "wrap" wraps every visible character and restores the previous value afterwards (see :func:ass_wrap_range). only_if_missing: leave the line untouched when a tag with this name is already present anywhere in the line. in_place: write back to the document (single-line and selection mode). Snapshot-backed; the raw-string mode never writes.

Indices: this tool edits whole override blocks, so it never takes character offsets. Neither the plain-character index of the visible text nor the raw index of the line is used or reported — but every where mode leaves both maps of the visible characters unchanged (a tag is only ever inserted between characters).

Returns {"source", "index", "doc_id", "name", "argument", "tag", "where", "text", "changed", "written", "skipped", "reason", "warnings"} for a single line (tag is the exact tag text produced, e.g. \fad(200,200)) or {"source": "selection", "doc_id", "name", "tag", "where", "count", "changed", "written", "in_place", "lines": [...]} for a selection. duration-style arguments are passed through verbatim.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argNo
nameNo
textNo
indexNo
valueNo
whereNoafter_first_block
doc_idNo
in_placeNo
selectionNo
only_if_missingNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it documents that raw-string mode never writes, that in_place writes are snapshot-backed, that braces/line breaks/out-of-range \an and \a values are rejected, and that the tool never uses character offsets and leaves character maps unchanged. This is unusually rich behavioral disclosure for a mutation 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 a one-line summary followed by a structured Args list where each entry earns its place. It is long, but the length is driven by genuine per-parameter semantics rather than filler; only minor tightening is possible.

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?

For a 10-parameter, zero-annotation, zero-coverage tool, the description supplies everything needed: mode selection, parameter meaning, validation behavior, write semantics, and an index caveat. The return shape is already given by the output schema, so the extra return description is a bonus rather than a gap.

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

Parameters5/5

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

Schema coverage is 0% and there are 10 parameters, so the description must compensate entirely — and it does, documenting selection/index/text/doc_id, the name format and backslash allowance, arg vs value alias precedence, all five where modes with their merge/insert semantics, only_if_missing, and in_place write scope. Every parameter is covered with meaning beyond its bare name.

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 opening sentence gives a specific verb and resource ('Insert (or update) a single override tag on a line or a selection') and even distinguishes insert-vs-update behavior. It doesn't differentiate from tag-manipulation siblings such as ass_insert_tag_at or ass_apply_tag_to_block, which keeps it short of a 5.

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?

It clearly signals the two operating modes (selection vs single-line via text/index/doc_id) and when only_if_missing or in_place apply, but it never states when to prefer this tool over sibling tag tools. Usage is implied by the argument semantics rather than spelled out as explicit routing guidance.

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

Deploy Server

Other Tools