Skip to main content
Glama

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
NameRequiredDescriptionDefault
archived_stateNoFilter by card archived state
column_idYesThe unique identifier of the column
pageNoPage number for pagination (starts at 1)
per_pageNoNumber of results per page (max 100)

Implementation Reference

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

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