things_get_anytime
Retrieve all to-dos from the Anytime list in Things 3 on macOS, with optional result limits for task management.
Instructions
Get all to-dos in Anytime
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_results | No | Limit number of results returned (defaults to all if not specified) |
Implementation Reference
- src/tools/get.ts:26-30 (registration)Registration of the things_get_anytime tool.
{ name: 'things_get_anytime', description: 'Get all to-dos in Anytime', schema: GetListSchema }, - src/tools/get.ts:109-173 (handler)The execute method handles the logic for 'things_get_anytime' by mapping it to the 'get-anytime' script and executing it via AppleScript.
async execute(toolName: string, params: GetParams): Promise<string> { let scriptName: string; // Handle the get_list tool separately if (toolName === 'things_get_list') { const listParams = params as z.infer<typeof GetListByNameSchema>; scriptName = this.listNameToScript[listParams.list]; if (!scriptName) { throw new Error(`Unknown list: ${listParams.list}`); } } else { scriptName = this.scriptMap[toolName]; if (!scriptName) { throw new Error(`Unknown tool: ${toolName}`); } } let scriptArgs: string[] = []; const options = { maxResults: (params as any).max_results }; // Handle specific tools that need arguments if (toolName === 'things_get_project') { const projectParams = params as z.infer<typeof GetProjectSchema>; scriptArgs = [projectParams.project_id]; } else if (toolName === 'things_get_area') { const areaParams = params as z.infer<typeof GetAreaSchema>; scriptArgs = [areaParams.area_id]; } else if (toolName === 'things_get_todo_details') { const todoParams = params as z.infer<typeof GetTodoDetailsSchema>; scriptArgs = [todoParams.id]; // Don't pass maxResults for todo details since it's a single item delete options.maxResults; } const output = await executeAppleScriptFile(scriptName, scriptArgs, options); // Return empty array for empty output if (!output.trim()) { const emptyResult = toolName.includes('project') || toolName.includes('area') ? { todos: [] } : { [this.getResultKey(toolName)]: [] }; return JSON.stringify(emptyResult, null, 2); } // Parse based on tool type let result; switch (toolName) { case 'things_get_projects': result = { projects: parseProjectList(output) }; break; case 'things_get_areas': result = { areas: parseAreaList(output) }; break; case 'things_get_tags': result = { tags: parseTagList(output) }; break; case 'things_get_todo_details': result = parseTodoDetails(output); break; default: result = { todos: parseTodoList(output) }; } return JSON.stringify(result, null, 2); } - src/tools/get.ts:83-88 (helper)Mapping of tool names to their corresponding AppleScript filenames.
private scriptMap: Record<string, string> = { 'things_get_inbox': 'get-inbox', 'things_get_today': 'get-today', 'things_get_upcoming': 'get-upcoming', 'things_get_anytime': 'get-anytime', 'things_get_someday': 'get-someday',