create_project_view
Create a new view for a GitHub project to organize tasks using board, table, timeline, or roadmap layouts.
Instructions
Create a new view for a GitHub project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ||
| name | Yes | ||
| layout | Yes |
Implementation Reference
- Core handler: Executes GraphQL mutation `createProjectV2View` to create a new GitHub Projects v2 view with specified name and layout.async createView(projectId: ProjectId, name: string, layout: ProjectView["layout"]): Promise<ProjectView> { const mutation = ` mutation($input: CreateProjectV2ViewInput!) { createProjectV2View(input: $input) { projectV2View { id name layout } } } `; try { const graphqlLayout = mapToGraphQLViewLayout(layout); const variables = { input: { projectId, name, layout: graphqlLayout } }; const response = await this.graphql<CreateProjectV2ViewResponse>(mutation, variables); if (!response.createProjectV2View?.projectV2View) { throw new Error('Failed to create project view: Invalid response from GitHub API'); } const view = response.createProjectV2View.projectV2View; return { id: view.id, name: view.name, layout: view.layout.toLowerCase() as ViewLayout, fields: [], sortBy: [], groupBy: undefined, filters: [] }; } catch (error) { this.logger.error(`Failed to create project view for project ${projectId}`, error); throw this.handleGraphQLError(error); }
- Service layer handler: Validates input and delegates to GitHubProjectRepository.createViewasync createProjectView(data: { projectId: string; name: string; layout: 'board' | 'table' | 'timeline' | 'roadmap'; }): Promise<ProjectView> { try { return await this.projectRepo.createView( data.projectId, data.name, data.layout ); } catch (error) { throw this.mapErrorToMCPError(error); } }
- src/index.ts:393-394 (handler)MCP tool dispatcher: Routes 'create_project_view' tool calls to ProjectManagementService.createProjectViewcase "create_project_view": return await this.service.createProjectView(args);
- Tool definition including Zod input schema (projectId, name, layout), description, and examplesexport const createProjectViewTool: ToolDefinition<CreateProjectViewArgs> = { name: "create_project_view", description: "Create a new view for a GitHub project", schema: createProjectViewSchema as unknown as ToolSchema<CreateProjectViewArgs>, examples: [ { name: "Create kanban board view", description: "Create a board view for a project", args: { projectId: "PVT_kwDOLhQ7gc4AOEbH", name: "Development Board", layout: "board" } } ] };
- src/infrastructure/tools/ToolRegistry.ts:247-247 (registration)Registers createProjectViewTool in the central ToolRegistry singleton (imported from ToolSchemas.ts line 44)this.registerTool(createProjectViewTool);