add_todo
Create new to-do items with title, notes, tags, deadlines, and checklists. Organize tasks into projects and set time schedules for better task management.
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 for the 'add_todo' tool. It constructs a Things URL scheme using buildThingsUrl('add', args) and opens it via openThingsUrl to create the todo item, then returns a success message.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 definition for the 'add_todo' tool, specifying properties like title, notes, when, deadline, tags, checklistItems, etc., with types and descriptions.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)Registration of the 'add_todo' tool in the ListToolsRequestSchema handler, including 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/index.js:427-428 (registration)Dispatch case in the CallToolRequestSchema handler that routes 'add_todo' calls to the handleAddTodo method.case 'add_todo': return await this.handleAddTodo(args);
- src/utils.js:84-93 (helper)Helper utility function buildThingsUrl used by the handler to construct the Things URL scheme for the 'add' command with encoded parameters.export function buildThingsUrl(command, params = {}) { const baseUrl = `things:///${command}`; const queryString = buildQueryString(params); if (!queryString) { return baseUrl; } return `${baseUrl}?${queryString}`; }