list_project_columns
Retrieve all columns in a specified GitHub project with pagination support. Use this tool to organize and manage project tasks effectively by viewing column structures.
Instructions
List all columns in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination (starts at 1) | |
| per_page | No | Number of results per page (max 100) | |
| project_id | Yes | The unique identifier of the project |
Implementation Reference
- operations/projects.ts:211-248 (handler)The core handler function that executes the tool logic by calling the GitHub API to list columns for a given project ID with optional pagination.export async function listProjectColumns(projectId: number, page?: number, perPage?: number) { try { const params: Record<string, string | number | undefined> = {}; if (page) { params.page = page; } if (perPage) { params.per_page = perPage; } let url = `https://api.github.com/projects/${projectId}/columns`; // 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 project columns: ${(error as Error).message}`, 500, { error: (error as Error).message }); } }
- operations/projects.ts:46-50 (schema)Zod schema defining the input parameters (project_id, optional page, per_page) for the list_project_columns tool.export const ListProjectColumnsSchema = z.object({ project_id: z.number().describe("The unique identifier of the project"), 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:231-234 (registration)Tool registration in the list of available tools returned by ListToolsRequest.name: "list_project_columns", description: "List all columns in a project", inputSchema: zodToJsonSchema(projects.ListProjectColumnsSchema), },
- index.ts:643-653 (handler)Dispatcher case in the main CallToolRequest handler that parses arguments and delegates to the projects.listProjectColumns function.case "list_project_columns": { const args = projects.ListProjectColumnsSchema.parse(request.params.arguments); const result = await projects.listProjectColumns( args.project_id, args.page, args.per_page ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }