get_my_tasks
List tasks assigned to the bot account, with optional filters for assigner account ID and task status (open or done).
Instructions
List tasks assigned to the current bot account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assigned_by_account_id | No | Filter by the account ID who assigned the task. | |
| status | No | Task status (open or done). | open |
Implementation Reference
- src/tools/getMyTasks.ts:5-20 (handler)The main tool definition object with name ('get_my_tasks'), description, schema, and executor function that calls client.getMyTasks() and returns the result as JSON text content.
export const getMyTasksTool = { name: "get_my_tasks", description: "List tasks assigned to the current bot account.", schema: GetMyTasksSchema, executor: async (client: ChatworkClient, args: z.infer<typeof GetMyTasksSchema>) => { const tasks = await client.getMyTasks(args.assigned_by_account_id, args.status); return { content: [ { type: "text" as const, text: JSON.stringify(tasks, null, 2), }, ], }; }, }; - src/schemas/tasks.ts:10-13 (schema)Zod schema defining inputs: optional assigned_by_account_id (number) and optional status enum ('open'|'done') defaulting to 'open'.
export const GetMyTasksSchema = z.object({ assigned_by_account_id: z.number().optional().describe("Filter by the account ID who assigned the task."), status: z.enum(["open", "done"]).optional().default("open").describe("Task status (open or done)."), }); - src/index.ts:74-82 (registration)Registration of the tool with the MCP server via server.tool(), using the tool's name, description, schema shape, and executor.
server.tool( getMyTasksTool.name, getMyTasksTool.description, getMyTasksTool.schema.shape, async (args) => { // @ts-ignore return getMyTasksTool.executor(client, args); } ); - src/api/client.ts:96-111 (helper)API client method getMyTasks() that makes a GET request to /my/tasks with optional assigned_by_account_id and status query parameters.
async getMyTasks(assignedByAccountId?: number, status: "open" | "done" = "open"): Promise<ChatworkTask[]> { try { const params: any = { status }; if (assignedByAccountId) { params.assigned_by_account_id = assignedByAccountId; } const response = await this.client.get<ChatworkTask[]>("/my/tasks", { params }); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Chatwork API Error (Get My Tasks): ${error.message} - ${JSON.stringify(error.response?.data)}`); } throw error; } } - src/tools/index.ts:6-7 (registration)Re-export of the getMyTasksTool from the tools barrel module.
export * from "./getMyTasks.js"; export * from "./deleteMessage.js";