create_project_v2
Create a new GitHub project V2 by specifying an owner ID, title, and optional description using the GraphQL API. Streamline GitHub project management and organization.
Instructions
Create a new GitHub project V2 using GraphQL API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Description of the project | |
| ownerId | Yes | The node ID of the organization or user | |
| title | Yes | Title of the project |
Implementation Reference
- operations/projectsV2.ts:193-234 (handler)Core handler function that executes the GraphQL mutation to create a new GitHub Project V2.export async function createProjectV2(ownerId: string, title: string, description?: string) { try { const query = ` mutation($input: CreateProjectV2Input!) { createProjectV2(input: $input) { projectV2 { id title shortDescription url closed createdAt updatedAt number } } } `; const variables = { input: { ownerId, title, description: description || "" } }; const response = await graphqlRequest(query, variables); return response.data.createProjectV2.projectV2; } catch (error) { if (error instanceof GitHubError) { throw error; } throw new GitHubError( `Failed to create project v2: ${(error as Error).message}`, 500, { error: (error as Error).message } ); } }
- operations/projectsV2.ts:22-26 (schema)Zod schema defining the input parameters for the create_project_v2 tool.export const CreateProjectV2Schema = z.object({ ownerId: z.string().describe("The node ID of the organization or user"), title: z.string().describe("Title of the project"), description: z.string().optional().describe("Description of the project") });
- index.ts:280-284 (registration)Tool registration in the list of tools provided by ListToolsRequestSchema.{ name: "create_project_v2", description: "Create a new GitHub project V2 using GraphQL API", inputSchema: zodToJsonSchema(projectsV2.CreateProjectV2Schema), },
- index.ts:756-766 (handler)Dispatch handler in the main CallToolRequestSchema switch that invokes the specific createProjectV2 function.case "create_project_v2": { const args = projectsV2.CreateProjectV2Schema.parse(request.params.arguments); const result = await projectsV2.createProjectV2( args.ownerId, args.title, args.description ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }