Skip to main content
Glama

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
NameRequiredDescriptionDefault
pageNoPage number for pagination (starts at 1)
per_pageNoNumber of results per page (max 100)
project_idYesThe unique identifier of the project

Implementation Reference

  • 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 });
        }
    }
  • 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),
    },
  • 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) }],
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tuanle96/mcp-github'

If you have feedback or need assistance with the MCP directory API, please join our Discord server