Skip to main content
Glama

get-project-structure

Retrieve the hierarchical structure of a Things 3 project to analyze tasks and relationships for project management.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_uuidYesUUID of the project to inspect

Implementation Reference

  • The core logic for retrieving and structuring project data (project, headings, and todos).
    export function buildProjectStructure(tasks: TaskLike[], projectUuid: string) {
      const project = tasks.find(
        (task) => task.type === "project" && task.id === projectUuid && !task.trashed
      );
    
      if (!project) {
        throw new Error(`Project not found: ${projectUuid}`);
      }
    
      const headings = tasks.filter(
        (task) => task.type === "heading" && task.projectId === projectUuid && !task.trashed
      );
      const todos = tasks.filter(
        (task) => task.type === "to-do" && task.projectId === projectUuid && !task.trashed
      );
      const todosWithoutHeading = todos.filter((task) => !task.headingId);
    
      return {
        project,
        headings,
        todos,
        todosWithoutHeading,
        compact: {
          project: toTaskView(project, "compact"),
          headings: headings.map((heading) => ({
            ...toTaskView(heading, "compact"),
            todoCount: todos.filter((task) => task.headingId === heading.id).length,
          })),
          todosWithoutHeading: todosWithoutHeading.map((task) => toTaskView(task, "compact")),
          counts: {
            headings: headings.length,
            todos: todos.length,
            todosWithoutHeading: todosWithoutHeading.length,
          },
        },
      };
    }
  • src/index.ts:1573-1585 (registration)
    Registration of the 'get-project-structure' tool.
    server.tool(
      "get-project-structure",
      {
        project_uuid: z.string().describe("UUID of the project to inspect"),
      },
      async ({ project_uuid }) => {
        const structure = await withDatabase((db) =>
          buildProjectStructure(getAllTasks(db), project_uuid).compact
        );
    
        return buildTextResponse(`Read project structure for ${structure.project.title}`, structure);
      }
    );

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