get-project-structure
Retrieve the hierarchical structure of a Things 3 project to analyze tasks and relationships for project management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_uuid | Yes | UUID of the project to inspect |
Implementation Reference
- src/project-structure.ts:40-76 (handler)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); } );