Skip to main content
Glama

get-tags

Retrieve all tags from Things 3 database to organize and categorize tasks for better project management and workflow optimization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_itemsNoInclude items tagged with each tag

Implementation Reference

  • The "get-tags" tool definition and handler, which queries the database for tags and optionally includes tasks associated with each tag.
    server.tool(
      "get-tags",
      {
        include_items: z.boolean().optional().describe("Include items tagged with each tag"),
      },
      async ({ include_items }) => {
        const data = await withDatabase((db) => {
          const tags = getTags(db);
          if (!include_items) return tags;
    
          const tasks = getAllTasks(db);
          return tags.map((tag) => ({
            ...tag,
            items: tasks.filter((task) => task.tags.includes(tag.title)),
          }));
        });
        return buildTextResponse(`Found ${data.length} tags`, { tags: data });
      }
    );
  • Helper function `getTags` that executes the SQL query to retrieve all tags from the database.
    function getTags(db: DatabaseSync): TagRecord[] {
      return db
        .prepare(
          `
          SELECT uuid, title, shortcut
          FROM TMTag
          ORDER BY "index"
          `
        )
        .all() as Array<TagRecord>;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/soycanopa/SupaThings-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server