listTasks
Retrieve tasks from the Godspeed task application based on specific criteria such as list ID, status, or update timestamps. Integrate with the godspeed-mcp server to manage task data efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | No | ||
| status | No | ||
| updated_after | No | ||
| updated_before | No |
Implementation Reference
- src/godspeed.ts:212-241 (handler)Core handler function in GodspeedAPI that executes the listTasks logic: builds query parameters from input and performs GET request to the Godspeed API /tasks endpoint.async listTasks(params?: ListTasksParams): Promise<ApiResponse<Task[]>> { try { const headers = this.getAuthHeaders(); // Build query string from params const queryParams = params ? Object.entries(params) .filter(([_, value]) => value !== undefined) .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`) .join('&') : ''; const url = `${API_BASE_URL}/tasks${queryParams ? `?${queryParams}` : ''}`; const response = await fetch(url, { method: 'GET', headers, }); const data = await response.json(); if (!response.ok) { throw new Error(data.error || 'Failed to list tasks'); } return data; } catch (error) { throw new Error(`List tasks error: ${error instanceof Error ? error.message : String(error)}`); } }
- src/types.ts:68-73 (schema)TypeScript interface defining the input parameters for the listTasks tool.export interface ListTasksParams { status?: 'incomplete' | 'complete'; list_id?: string; updated_before?: string; updated_after?: string; }
- src/index.ts:46-66 (registration)Registers the 'listTasks' tool with the MCP server, providing Zod input schema matching ListTasksParams and a thin async handler that delegates to GodspeedAPI.listTasks and formats the response.server.tool( "listTasks", { status: z.enum(["incomplete", "complete"]).optional(), list_id: z.string().optional(), updated_before: z.string().optional(), updated_after: z.string().optional() }, async (params) => { try { const result = await godspeedApi.listTasks(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }] }; } } );