Skip to main content
Glama

move_card

Move a GitHub card to a specified position or column by providing the card ID, target position, and optional column ID for organization.

Instructions

Move a card to a different position or column

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_idYesThe unique identifier of the card
column_idNoThe column ID to move the card to
positionYesThe position of the card (top, bottom, or after:<card_id>)

Implementation Reference

  • The core handler function that executes the move_card tool logic by making a POST request to GitHub's API to move the project card.
    export async function moveCard(cardId: number, position: string, columnId?: number) {
        try {
            const url = `https://api.github.com/projects/columns/cards/${cardId}/moves`;
    
            const payload: Record<string, any> = {
                position: position
            };
    
            if (columnId) {
                payload.column_id = columnId;
            }
    
            await githubRequest(url, {
                method: 'POST',
                body: payload,
                headers: {
                    'Accept': 'application/vnd.github.inertia-preview+json'
                }
            });
    
            return { success: true };
        } catch (error) {
            if (error instanceof GitHubError) {
                throw error;
            }
    
            throw new GitHubError(`Failed to move card: ${(error as Error).message}`, 500, { error: (error as Error).message });
        }
    }
  • Zod input schema for the move_card tool defining parameters: card_id, position, and optional column_id.
    export const MoveCardSchema = z.object({
        card_id: z.number().describe("The unique identifier of the card"),
        position: z.enum(["top", "bottom"]).or(z.string().regex(/^after:\d+$/)).describe("The position of the card (top, bottom, or after:<card_id>)"),
        column_id: z.number().optional().describe("The column ID to move the card to"),
    });
  • index.ts:255-259 (registration)
    Registration of the move_card tool in the MCP server's list of tools, including name, description, and input schema reference.
    {
      name: "move_card",
      description: "Move a card to a different position or column",
      inputSchema: zodToJsonSchema(projects.MoveCardSchema),
    },
  • Dispatcher case in the central CallToolRequest handler that parses arguments and calls the moveCard function.
    case "move_card": {
      const args = projects.MoveCardSchema.parse(request.params.arguments);
      const result = await projects.moveCard(
        args.card_id,
        args.position,
        args.column_id
      );
      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