delete_todo
Remove a todo item from the Things 3 task management app by marking it as canceled using its unique ID.
Instructions
删除待办事项(通过将其标记为已取消)。需要提供待办事项ID和授权令牌。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 待办事项的ID(必需) | |
| authToken | No | 授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN) |
Implementation Reference
- src/index.js:613-637 (handler)The handler function that executes the delete_todo tool. It marks the todo as canceled by building and opening a Things update URL.async handleDeleteTodo(args) { const authToken = args.authToken || DEFAULT_AUTH_TOKEN; if (!authToken) { throw new Error('需要授权令牌。请设置环境变量THINGS_AUTH_TOKEN或在参数中提供authToken'); } // 通过将 canceled 设为 true 来实现删除效果 const params = { id: args.id, authToken, canceled: true, }; const url = buildThingsUrl('update', params); await this.openThingsUrl(url); return { content: [ { type: 'text', text: `🗑️ 待办事项已删除 (ID: ${args.id})`, }, ], }; }
- src/index.js:385-398 (schema)Input schema defining parameters for the delete_todo tool: id (required string), authToken (optional string).inputSchema: { type: 'object', properties: { id: { type: 'string', description: '待办事项的ID(必需)', }, authToken: { type: 'string', description: '授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN)', }, }, required: ['id'], },
- src/index.js:382-399 (registration)Registration of the delete_todo tool in the server's tools list, including name, description, and input schema.{ name: 'delete_todo', description: '删除待办事项(通过将其标记为已取消)。需要提供待办事项ID和授权令牌。', inputSchema: { type: 'object', properties: { id: { type: 'string', description: '待办事项的ID(必需)', }, authToken: { type: 'string', description: '授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN)', }, }, required: ['id'], }, },
- src/index.js:435-436 (registration)Switch case in the request handler that routes calls to delete_todo to the handleDeleteTodo function.case 'delete_todo': return await this.handleDeleteTodo(args);