// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { Metadata, asTextContentResult } from 'chunkr-ai-mcp/tools/types'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; import Chunkr from 'chunkr-ai'; export const metadata: Metadata = { resource: 'tasks', operation: 'read', tags: [], httpMethod: 'get', httpPath: '/tasks', operationId: 'list_tasks_route', }; export const tool: Tool = { name: 'list_tasks', description: 'Lists tasks for the authenticated user with cursor-based pagination\nand optional filtering by date range. Supports ascending or descending\nsort order and optional inclusion of chunks/base64 URLs.', inputSchema: { type: 'object', properties: { base64_urls: { type: 'boolean', description: 'Whether to return base64 encoded URLs. If false, the URLs will be returned as presigned URLs.', }, cursor: { type: 'string', description: 'Cursor for pagination (timestamp)', format: 'date-time', }, end: { type: 'string', description: 'End date', format: 'date-time', }, include_chunks: { type: 'boolean', description: 'Whether to include chunks in the output response', }, limit: { type: 'integer', description: 'Number of tasks per page', }, sort: { type: 'string', description: "Sort order: 'asc' for ascending, 'desc' for descending (default)", enum: ['asc', 'desc'], }, start: { type: 'string', description: 'Start date', format: 'date-time', }, statuses: { type: 'array', description: 'Filter by one or more statuses', items: { type: 'string', description: 'The status of the task.', enum: ['Starting', 'Processing', 'Succeeded', 'Failed', 'Cancelled'], }, }, task_types: { type: 'array', description: 'Filter by one or more task types', items: { type: 'string', enum: ['Parse', 'Extract'], }, }, }, required: [], }, annotations: { readOnlyHint: true, }, }; export const handler = async (client: Chunkr, args: Record | undefined) => { const body = args as any; const response = await client.tasks.list(body).asResponse(); return asTextContentResult(await response.json()); }; export default { metadata, tool, handler };