list_column_cards
Retrieve all cards in a GitHub project column by specifying the column ID, with options to filter by archived state and paginate results for efficient project management.
Instructions
List all cards in a project column
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| archived_state | No | Filter by card archived state | |
| column_id | Yes | The unique identifier of the column | |
| page | No | Page number for pagination (starts at 1) | |
| per_page | No | Number of results per page (max 100) |
Implementation Reference
- operations/projects.ts:374-415 (handler)Core implementation of the list_column_cards tool: fetches cards from a GitHub project column using the GitHub API, with support for archived_state, pagination.export async function listColumnCards(columnId: number, archivedState?: string, page?: number, perPage?: number) { try { const params: Record<string, string | number | undefined> = {}; if (archivedState) { params.archived_state = archivedState; } if (page) { params.page = page; } if (perPage) { params.per_page = perPage; } let url = `https://api.github.com/projects/columns/${columnId}/cards`; // Thêm query params nếu có if (Object.keys(params).length > 0) { const queryString = new URLSearchParams(); Object.entries(params).forEach(([key, value]) => { if (value !== undefined) { queryString.append(key, String(value)); } }); url += `?${queryString.toString()}`; } return await githubRequest(url, { headers: { 'Accept': 'application/vnd.github.inertia-preview+json' } }); } catch (error) { if (error instanceof GitHubError) { throw error; } throw new GitHubError(`Failed to list column cards: ${(error as Error).message}`, 500, { error: (error as Error).message }); } }
- operations/projects.ts:74-79 (schema)Input schema (Zod) for validating parameters of the list_column_cards tool.export const ListColumnCardsSchema = z.object({ column_id: z.number().describe("The unique identifier of the column"), archived_state: z.enum(["all", "archived", "not_archived"]).optional().describe("Filter by card archived state"), page: z.number().optional().describe("Page number for pagination (starts at 1)"), per_page: z.number().optional().describe("Number of results per page (max 100)"), });
- index.ts:251-254 (registration)Registration of the list_column_cards tool in the MCP server's list of tools, including name, description, and input schema reference.name: "list_column_cards", description: "List all cards in a project column", inputSchema: zodToJsonSchema(projects.ListColumnCardsSchema), },
- index.ts:689-700 (handler)MCP protocol handler for list_column_cards: parses input arguments using the schema and delegates to the core listColumnCards implementation.case "list_column_cards": { const args = projects.ListColumnCardsSchema.parse(request.params.arguments); const result = await projects.listColumnCards( args.column_id, args.archived_state, args.page, args.per_page ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }