Skip to content

feat(agent-mcp): expose tag categories to MCP - #923

Merged
h4yfans merged 3 commits into
mainfrom
mcp-tag-categories
Aug 3, 2026
Merged

feat(agent-mcp): expose tag categories to MCP#923
h4yfans merged 3 commits into
mainfrom
mcp-tag-categories

Conversation

@h4yfans

@h4yfans h4yfans commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

What

  • Allowlist tags.listCategories as an agent desktop read operation
  • Allowlist tags.createCategory / renameCategory / deleteCategory / reorder as write operations, so they run behind the existing write-approval flow
  • Widen TagCount with color, icon, sort_order, category_id, category_name and stop the adapter discarding them

Why

Tag categories shipped in #901 but were unreachable from MCP, and vault_get_tags narrowed each tag to name + count — an agent could not tell categories existed. getAllTagsWithCounts already carries every field except the category name, which the adapter now joins from listTagCategories.

Closes #918

Copilot AI review requested due to automatic review settings August 2, 2026 21:42
@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request test labels Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 559f3fb.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Exposes tag category operations and richer tag metadata to the Agent MCP surface so MCP clients can both discover categories and manage them via the existing desktop write-approval flow, while also preventing vault_get_tags from discarding category/color/icon/sort-order data.

Changes:

  • Added tags.listCategories to the MCP desktop read allowlist, and category write ops (createCategory, renameCategory, deleteCategory, reorder) to the write allowlist (approval-gated).
  • Extended the vault_get_tags return shape to include color, icon, sort_order, category_id, and category_name (joining category names via listTagCategories).
  • Updated tests and docs to reflect the newly exposed operations and expanded tag metadata.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/contracts/src/agent-mcp-channels.ts Allowlists new tag-category desktop operations for MCP read/write bridging.
packages/contracts/src/agent-mcp-channels.test.ts Adds allowlist coverage ensuring category ops are exposed in the correct list(s).
apps/docs/src/user-guide/ai/agent-mcp.md Documents tag-category operations and expanded vault_get_tags fields for MCP users.
apps/desktop/src/main/agent/mcp/tools/schemas.ts Updates vault_get_tags tool description to reflect expanded tag metadata.
apps/desktop/src/main/agent/mcp/tools/handles.ts Widens the TagCount tool-facing type to include category/color/icon/sort metadata.
apps/desktop/src/main/agent/mcp/tools/handles-adapter.ts Stops discarding tag metadata; joins category name from listTagCategories.
apps/desktop/src/main/agent/mcp/tools/handles-adapter.test.ts Verifies adapter preserves category/color/icon/sort fields and category-name join behavior.
apps/desktop/src/main/agent/mcp/tools/tests/read-tools.test.ts Updates vault_get_tags tool test to assert the expanded tag metadata is returned.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +235 to +237
Tag categories are reachable through the same bridge. `tags.listCategories` is a read operation that
returns each category with its id, name, sort order, and tag count. `tags.createCategory`,
`tags.renameCategory`, `tags.deleteCategory`, and `tags.reorder` are write operations behind the
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

h4yfans added a commit that referenced this pull request Aug 3, 2026
Review feedback on #923: the desktop bridge returns the raw IPC envelope,
so tags.listCategories yields { success, categories } rather than a bare
list. Name the shape for each category operation and note that failures
come back as { success: false, error } instead of an MCP error.
Copilot AI review requested due to automatic review settings August 3, 2026 09:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

h4yfans added a commit that referenced this pull request Aug 3, 2026
Review feedback on #923: the desktop bridge returns the raw IPC envelope,
so tags.listCategories yields { success, categories } rather than a bare
list. Name the shape for each category operation and note that failures
come back as { success: false, error } instead of an MCP error.
@h4yfans
h4yfans force-pushed the mcp-tag-categories branch from c655b14 to 6acd184 Compare August 3, 2026 11:05
Copilot AI review requested due to automatic review settings August 3, 2026 11:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@h4yfans
h4yfans marked this pull request as ready for review August 3, 2026 11:15
h4yfans added 3 commits August 3, 2026 14:15
Tag categories, the tag hub, and the single-tag page shipped in #901 but
were unreachable from MCP, and vault_get_tags narrowed each tag down to
name + count so an agent could not even tell that categories exist.

- allowlist tags.listCategories as a desktop read operation
- allowlist tags.createCategory / renameCategory / deleteCategory /
  reorder as write operations, so they run behind write approval
- widen TagCount with color, icon, sort_order, category_id and
  category_name; getAllTagsWithCounts already carries every field except
  the category name, which the adapter joins from listTagCategories

Closes #918
Review feedback on #923: the desktop bridge returns the raw IPC envelope,
so tags.listCategories yields { success, categories } rather than a bare
list. Name the shape for each category operation and note that failures
come back as { success: false, error } instead of an MCP error.
Copilot AI review requested due to automatic review settings August 3, 2026 11:15
@h4yfans
h4yfans force-pushed the mcp-tag-categories branch from 6acd184 to 559f3fb Compare August 3, 2026 11:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@h4yfans
h4yfans merged commit ffa0c59 into main Aug 3, 2026
16 checks passed
@h4yfans
h4yfans deleted the mcp-tag-categories branch August 3, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: tag categories are unreachable, and vault_get_tags strips the new fields

2 participants