obsidian-copilot icon indicating copy to clipboard operation
obsidian-copilot copied to clipboard

Command to get all tags

Open ichts opened this issue 4 months ago • 2 comments

Feature Request: Built-in Command to Get All Tags

User Story:

As a user, I want a built-in command that retrieves a list of all tags in my vault so that I can easily use this list in custom commands, specifically for recommending tags for notes.

Problem:

Currently, there isn't a direct way to get a complete list of all tags in the vault. Users have to rely on scripts or vault-wide searches, which can be cumbersome and less efficient.

Proposed Solution:

Implement a new built-in command (e.g., /get-all-tags) that returns a list of all tags present in the vault. This command could then be used within custom commands or agents to provide context, such as for a "recommend tag" feature.

Benefits:

  • Simplifies the process of accessing all tags in the vault.
  • Enables more efficient and user-friendly custom commands, such as tag recommendation.
  • Reduces the need for external scripts or complex workarounds.

Example Use Case:

A user wants to create a custom command that suggests relevant tags for a note. The command would use the /get-all-tags command to retrieve the list of available tags and then use an agent prompt to suggest the most appropriate ones for the current note.

ichts avatar Aug 18 '25 16:08 ichts

Might be good to reference/document the original post / message of this feature request

logancyang avatar Aug 19 '25 05:08 logancyang

@ichts I'm using the Templater script below as a workaround:

<%*
const tags = tp.app.metadataCache.getTags();
tR += "- " + Object.keys(tags).sort().join("\n- ")
%>

When applied to a note, it creates a taglist (see screenshot below) that is suitable for Copilot project contexts or direct inclusion in prompts via [[Taglist]]. Not quite as elegant as your feature request, but something that works now.

Image

WetHat avatar Sep 01 '25 12:09 WetHat