Tags
List, apply, and remove the labels that group documents across projects
Overview
Tags are free-form labels on documents. They group work by theme, such as a customer, platform, or initiative, without changing which project the work lives in. To group a set of issues under a theme, apply a tag rather than creating a project for it.
Tags are readable and writable over MCP:
| Tool | Scope |
|---|---|
list-tags | read |
tag-artifact | read and write |
untag-artifact | read and delete |
tag-artifact and untag-artifact need read as well, because each one reads the document and the tag list before it writes. Scopes do not imply each other: a credential with write but not read is not offered tag-artifact.
A tool is offered to a session only when the session's credential carries its scopes. When a call fails, the tool returns an isError result whose text gives the error title, a description, and, when the API sent them, the error code, message, and timestamp.
Rules
| Rule | Value |
|---|---|
| Name matching | Case-insensitive: dsp matches an existing DSP tag. Names are not trimmed before matching. |
| Name length, when creating a new tag | 1–40 characters |
| Allowed characters, when creating a new tag | Letters, numbers, spaces, and hyphens |
| Color | Chosen by the server |
| What can be tagged | Documents only: PRD-*, PLN-*, ISS-* (and legacy FEA-*), and DOC-*. Templates are rejected. Projects, branches, deployments, and agent sessions cannot be tagged with these tools. |
The length and character rules apply only when a tag is created. An existing tag whose stored name falls outside them is still listed by list-tags and still matched by name by tag-artifact and untag-artifact.
GitHub side effects
- Applying a tag can add a label on GitHub. After a tag is applied, labels on the document's linked pull requests are reconciled, so a label may appear on a pull request.
- Removing a tag does not remove a label. Reconciliation only adds labels. Removing a tag leaves any label it already pushed, and the reconciliation that runs after removal, over the document's remaining tags, can add a missing label for one of those other tags.
List Tags
Tool: list-tags
Scope: read
Underlying API: GET /tags?limit=<limit>&includeTotal=true plus &offset=<offset> and &search=<term> when given
Returns one page of the organization's tags, ordered by name. It returns a page, not the whole catalogue: page with nextOffset until hasMore is false before concluding that a tag does not exist, or use search.
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Page size, 1–100. Default 25. |
offset | integer | No | Starting offset, 0–10,000. Default 0. |
search | string | No | Case-insensitive substring filter on the tag name. Trimmed; must be at least 1 character after trimming. |
Returns
A paginated envelope. Each item is the tag's id, name, and color:
{
"total": 3,
"offset": 0,
"limit": 25,
"returned": 3,
"hasMore": false,
"nextOffset": null,
"items": [
{ "id": "1f2e3d4c-...", "name": "agent-fleet", "color": "blue" },
{ "id": "2a3b4c5d-...", "name": "DSP", "color": "green" },
{ "id": "3c4d5e6f-...", "name": "Enterprise", "color": "purple" }
]
}color is null when the stored tag has no color value.
Errors
limit,offset, orsearchoutside the limits above is rejected by input validation.
Example
list-tags(search: "dsp")Tag a Document
Tool: tag-artifact
Scope: read, write
Underlying API: GET /documents/{documentId}, then GET /tags?name=<tagName>&includeTotal=true, then POST /tags (only when no tag matches), then POST /entity-tags
Applies a named tag to a document. If the organization has no tag with that name (case-insensitively), the tag is created first, so tagging with a new name is a single call.
The document is resolved before any tag is created, so a bad documentId does not leave a new tag behind. Re-applying a tag the document already has does not add a second link, but the GitHub label reconciliation still runs.
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document UUID or slug (e.g. PRD-7, PLN-12, ISS-42, DOC-3). Blank values, ., and .. are rejected. |
tagName | string | Yes | Tag name, minimum 1 character. Matched case-insensitively against existing tags. A name that matches nothing creates a new tag, which must follow the creation rules. |
Returns
{
"applied": true,
"artifactId": "0b9a8c7d-...",
"tag": { "id": "2a3b4c5d-...", "name": "DSP", "color": "green" },
"created": false
}created is true when this call created the tag.
Errors
- The document does not exist in your organization: a not-found error from
GET /documents/{documentId}. - The document is a template:
Document "<id>" is a template. Templates are internal blueprints and cannot be tagged — tag the PRD, plan, issue, or document created from one instead. - A new tag name longer than 40 characters, or with characters other than letters, numbers, spaces, and hyphens: a 400 from the API (
Name may only contain letters, numbers, spaces, and hyphensfor the character rule). - If a concurrent call creates the same name first, the tool re-reads and uses that tag. If the name is still missing after two attempts, the tool fails with
Tag "<name>" reported a naming conflict but was absent on re-read after 2 attempts. - If this call created the tag and then applying it failed, the error message ends with a note that the tag was created and still exists. Retrying reuses it.
Example
tag-artifact(documentId: "ISS-42", tagName: "DSP")Remove a Tag from a Document
Tool: untag-artifact
Scope: read, delete
Underlying API: GET /documents/{documentId}, then GET /tags?name=<tagName>&includeTotal=true, then DELETE /entity-tags?tagId=<id>&entityType=ARTIFACT&entityId=<artifactId>
Removes the link between a tag and a document. The tag itself stays in the organization for reuse. Nothing is ever created by this tool.
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document UUID or slug. |
tagName | string | Yes | Tag name, minimum 1 character, matched case-insensitively. |
Returns
When a tag with that name exists:
{
"removed": true,
"artifactId": "0b9a8c7d-...",
"tag": { "id": "2a3b4c5d-...", "name": "DSP", "color": "green" }
}removed: true means the tag is not on the document after the call. It is also returned when the document did not have the tag.
When no tag with that name exists in the organization, the call succeeds without removing anything:
{
"removed": false,
"artifactId": "0b9a8c7d-...",
"tagName": "DSP",
"reason": "No tag named \"DSP\" exists in this organization, so nothing was removed."
}Errors
- The document does not exist in your organization: a not-found error from
GET /documents/{documentId}. - The document is a template: the same template error as
tag-artifact.
Example
untag-artifact(documentId: "ISS-42", tagName: "DSP")