add_todo
Create new to-do items in Things 3 with title, notes, tags, checklist items, deadlines, and project organization.
Instructions
创建新的待办事项。支持标题、备注、标签、清单、截止日期等。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | 待办事项标题 | |
| titles | No | 批量创建待办事项,用换行符分隔 | |
| notes | No | 备注内容 | |
| when | No | 时间安排: today, tomorrow, evening, anytime, someday, 日期(yyyy-mm-dd)或日期时间(yyyy-mm-dd@HH:mm) | |
| deadline | No | 截止日期(yyyy-mm-dd) | |
| tags | No | 标签,逗号分隔 | |
| checklistItems | No | 清单项列表 | |
| listId | No | 项目或区域的ID | |
| list | No | 项目或区域的标题 | |
| headingId | No | 项目内标题的ID | |
| heading | No | 项目内标题的名称 | |
| completed | No | 是否标记为完成 | |
| canceled | No | 是否标记为取消 | |
| reveal | No | 是否导航并显示 |
Implementation Reference
- src/index.js:473-485 (handler)The main handler function that builds and opens a Things URL scheme for creating a new todo item.async handleAddTodo(args) { const url = buildThingsUrl('add', args); await this.openThingsUrl(url); return { content: [ { type: 'text', text: `✅ 待办事项创建命令已发送${args.title ? `: ${args.title}` : ''}`, }, ], }; }
- src/index.js:54-115 (schema)Input schema defining the parameters for the add_todo tool, including title, notes, when, tags, etc.inputSchema: { type: 'object', properties: { title: { type: 'string', description: '待办事项标题', }, titles: { type: 'string', description: '批量创建待办事项,用换行符分隔', }, notes: { type: 'string', description: '备注内容', }, when: { type: 'string', description: '时间安排: today, tomorrow, evening, anytime, someday, 日期(yyyy-mm-dd)或日期时间(yyyy-mm-dd@HH:mm)', }, deadline: { type: 'string', description: '截止日期(yyyy-mm-dd)', }, tags: { type: 'string', description: '标签,逗号分隔', }, checklistItems: { type: 'array', items: { type: 'string' }, description: '清单项列表', }, listId: { type: 'string', description: '项目或区域的ID', }, list: { type: 'string', description: '项目或区域的标题', }, headingId: { type: 'string', description: '项目内标题的ID', }, heading: { type: 'string', description: '项目内标题的名称', }, completed: { type: 'boolean', description: '是否标记为完成', }, canceled: { type: 'boolean', description: '是否标记为取消', }, reveal: { type: 'boolean', description: '是否导航并显示', }, }, },
- src/index.js:51-116 (registration)Tool registration in the ListToolsRequestSchema handler, defining name, description, and inputSchema.{ name: 'add_todo', description: '创建新的待办事项。支持标题、备注、标签、清单、截止日期等。', inputSchema: { type: 'object', properties: { title: { type: 'string', description: '待办事项标题', }, titles: { type: 'string', description: '批量创建待办事项,用换行符分隔', }, notes: { type: 'string', description: '备注内容', }, when: { type: 'string', description: '时间安排: today, tomorrow, evening, anytime, someday, 日期(yyyy-mm-dd)或日期时间(yyyy-mm-dd@HH:mm)', }, deadline: { type: 'string', description: '截止日期(yyyy-mm-dd)', }, tags: { type: 'string', description: '标签,逗号分隔', }, checklistItems: { type: 'array', items: { type: 'string' }, description: '清单项列表', }, listId: { type: 'string', description: '项目或区域的ID', }, list: { type: 'string', description: '项目或区域的标题', }, headingId: { type: 'string', description: '项目内标题的ID', }, heading: { type: 'string', description: '项目内标题的名称', }, completed: { type: 'boolean', description: '是否标记为完成', }, canceled: { type: 'boolean', description: '是否标记为取消', }, reveal: { type: 'boolean', description: '是否导航并显示', }, }, }, },
- src/utils.js:84-93 (helper)Utility function to build the Things URL scheme from command and parameters, used in the add_todo handler.export function buildThingsUrl(command, params = {}) { const baseUrl = `things:///${command}`; const queryString = buildQueryString(params); if (!queryString) { return baseUrl; } return `${baseUrl}?${queryString}`; }
- src/index.js:464-471 (helper)Helper method to execute the Things URL by opening it with the system's 'open' command.async openThingsUrl(url) { try { await execAsync(`open "${url}"`); return { success: true }; } catch (error) { throw new Error(`无法打开Things URL: ${error.message}`); } }