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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the column | |
| owner | Yes | Repository owner (username or organization) | |
| project_number | Yes | The project number | |
| repo | Yes | Repository name |
Implementation Reference
- operations/projects.ts:251-277 (handler)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 }); } }
- operations/projects.ts:38-43 (schema)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),
- index.ts:630-641 (handler)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) }], }; }