delete_todo
Remove a todo item from your Things 3 task management system by marking it as canceled using its unique identifier.
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)Handler function that implements the delete_todo tool by building a Things URL to update the todo with canceled: true, effectively deleting it.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 for the delete_todo tool, defining required id and optional authToken.inputSchema: { type: 'object', properties: { id: { type: 'string', description: '待办事项的ID(必需)', }, authToken: { type: 'string', description: '授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN)', }, }, required: ['id'], },
- src/index.js:435-436 (registration)Registration of the delete_todo handler in the tool dispatch switch statement.case 'delete_todo': return await this.handleDeleteTodo(args);
- src/utils.js:84-93 (helper)Helper function used by the handler to construct the Things URL scheme for the update operation that cancels the todo.export function buildThingsUrl(command, params = {}) { const baseUrl = `things:///${command}`; const queryString = buildQueryString(params); if (!queryString) { return baseUrl; } return `${baseUrl}?${queryString}`; }
- src/index.js:382-399 (registration)Tool registration in the list of available tools, including name, description, and schema.{ name: 'delete_todo', description: '删除待办事项(通过将其标记为已取消)。需要提供待办事项ID和授权令牌。', inputSchema: { type: 'object', properties: { id: { type: 'string', description: '待办事项的ID(必需)', }, authToken: { type: 'string', description: '授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN)', }, }, required: ['id'], }, },