delete_project
Remove a project from the Things 3 task management app by marking it as canceled. Requires the project ID and authentication token.
Instructions
删除项目(通过将其标记为已取消)。需要提供项目ID和授权令牌。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 项目的ID(必需) | |
| authToken | No | 授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN) |
Implementation Reference
- src/index.js:639-663 (handler)The handler function for the delete_project tool. It retrieves the authToken, constructs parameters to set the project as canceled, builds a Things URL using buildThingsUrl('update-project'), opens the URL, and returns a success message.async handleDeleteProject(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-project', params); await this.openThingsUrl(url); return { content: [ { type: 'text', text: `🗑️ 项目已删除 (ID: ${args.id})`, }, ], }; }
- src/index.js:403-416 (schema)Input schema for the delete_project tool, requiring 'id' and optionally 'authToken'.inputSchema: { type: 'object', properties: { id: { type: 'string', description: '项目的ID(必需)', }, authToken: { type: 'string', description: '授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN)', }, }, required: ['id'], },
- src/index.js:400-417 (registration)Tool registration in the ListToolsRequestSchema handler, defining name, description, and inputSchema for delete_project.{ name: 'delete_project', description: '删除项目(通过将其标记为已取消)。需要提供项目ID和授权令牌。', inputSchema: { type: 'object', properties: { id: { type: 'string', description: '项目的ID(必需)', }, authToken: { type: 'string', description: '授权令牌(如未提供,将使用环境变量THINGS_AUTH_TOKEN)', }, }, required: ['id'], }, },
- src/index.js:437-438 (registration)Dispatch case in the CallToolRequestSchema handler switch statement that routes to the delete_project handler.case 'delete_project': return await this.handleDeleteProject(args);