Skip to main content
Glama

create_project_column

Add a new column to a GitHub project by specifying the repository owner, repository name, project number, and column name for organized task management.

Instructions

Create a new column in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the column
ownerYesRepository owner (username or organization)
project_numberYesThe project number
repoYesRepository name

Implementation Reference

  • The async function that implements the core logic of the 'create_project_column' tool. It retrieves the project ID using getProject and then sends a POST request to the GitHub API to create a new project column.
    export async function createProjectColumn(owner: string, repo: string, projectNumber: number, name: string) {
        try {
            // Trước tiên cần lấy project_id từ project_number
            const project = await getProject(owner, repo, projectNumber);
    
            // Tạo cột với project_id
            const url = `https://api.github.com/projects/${project.id}/columns`;
    
            const response = await githubRequest(url, {
                method: 'POST',
                body: {
                    name: name,
                },
                headers: {
                    'Accept': 'application/vnd.github.inertia-preview+json'
                }
            });
    
            return response;
        } catch (error) {
            if (error instanceof GitHubError) {
                throw error;
            }
    
            throw new GitHubError(`Failed to create project column: ${(error as Error).message}`, 500, { error: (error as Error).message });
        }
    }
  • Zod schema defining the input parameters and validation for the create_project_column tool.
    export const CreateProjectColumnSchema = z.object({
        owner: z.string().describe("Repository owner (username or organization)"),
        repo: z.string().describe("Repository name"),
        project_number: z.number().describe("The project number"),
        name: z.string().describe("Name of the column"),
    });
  • index.ts:226-228 (registration)
    Registration of the tool in the ListTools response, including name, description, and input schema reference.
    name: "create_project_column",
    description: "Create a new column in a project",
    inputSchema: zodToJsonSchema(projects.CreateProjectColumnSchema),
  • Handler dispatch in the main CallToolRequest switch statement that validates input and invokes the projects.createProjectColumn function.
    case "create_project_column": {
      const args = projects.CreateProjectColumnSchema.parse(request.params.arguments);
      const result = await projects.createProjectColumn(
        args.owner,
        args.repo,
        args.project_number,
        args.name
      );
      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