Skip to main content
Glama

add_card_to_column

Add a card containing an issue, pull request, or note to a specific project column in a GitHub repository. Specify the owner, repo, column ID, and content type for precise placement.

Instructions

Add a new card to a project column

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
column_idYesThe ID of the column to add card to
content_idNoID of the issue or pull request (required if content_type is Issue or PullRequest)
content_typeYesType of content for the card
noteNoThe note content for the card (required if content_type is Note)
ownerYesRepository owner (username or organization)
repoYesRepository name

Implementation Reference

  • Core implementation of the add_card_to_column tool: validates inputs, constructs payload, and makes POST request to GitHub API to add card to column.
    export async function addCardToColumn(
        owner: string,
        repo: string,
        columnId: string,
        contentType: string,
        contentId?: number,
        note?: string
    ) {
        try {
            const payload: any = {};
    
            if (contentType === 'Note') {
                if (!note) {
                    throw new GitHubError('Note content is required when content_type is Note', 400, { message: 'Missing note content' });
                }
                payload.note = note;
            } else {
                if (!contentId) {
                    throw new GitHubError('Content ID is required when content_type is Issue or PullRequest', 400, { message: 'Missing content ID' });
                }
    
                const actualContentType = contentType.toLowerCase();
                payload.content_id = contentId;
                payload.content_type = actualContentType;
            }
    
            const url = `https://api.github.com/projects/columns/${columnId}/cards`;
    
            const response = await githubRequest(url, {
                method: 'POST',
                body: payload,
                headers: {
                    'Accept': 'application/vnd.github.inertia-preview+json'
                }
            });
    
            return response;
        } catch (error) {
            if (error instanceof GitHubError) {
                throw error;
            }
    
            throw new GitHubError(`Failed to add card to column: ${(error as Error).message}`, 500, { error: (error as Error).message });
        }
    }
  • Zod schema defining input parameters for the add_card_to_column tool.
    export const AddCardToColumnSchema = z.object({
        owner: z.string().describe("Repository owner (username or organization)"),
        repo: z.string().describe("Repository name"),
        column_id: z.string().describe("The ID of the column to add card to"),
        content_type: z.enum(["Issue", "PullRequest", "Note"]).describe("Type of content for the card"),
        content_id: z.number().optional().describe("ID of the issue or pull request (required if content_type is Issue or PullRequest)"),
        note: z.string().optional().describe("The note content for the card (required if content_type is Note)"),
    });
  • index.ts:246-249 (registration)
    Registers the add_card_to_column tool in the MCP server tool list, including name, description, and input schema.
      name: "add_card_to_column",
      description: "Add a new card to a project column",
      inputSchema: zodToJsonSchema(projects.AddCardToColumnSchema),
    },
  • Top-level handler case in the MCP tool dispatcher that parses arguments and delegates to the projects.addCardToColumn implementation.
    case "add_card_to_column": {
      const args = projects.AddCardToColumnSchema.parse(request.params.arguments);
      const result = await projects.addCardToColumn(
        args.owner,
        args.repo,
        args.column_id,
        args.content_type,
        args.content_id,
        args.note
      );
      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