list_project_views
Fetch and display all views associated with a GitHub project using the specified project ID. Ideal for managing and organizing project layouts and workflows.
Instructions
List all views in a GitHub project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes |
Implementation Reference
- Main handler implementation that executes GraphQL query to fetch all views for a GitHub project and maps the response to ProjectView objects.async listProjectViews(data: { projectId: string; }): Promise<ProjectView[]> { try { const query = ` query($projectId: ID!) { node(id: $projectId) { ... on ProjectV2 { views(first: 20) { nodes { id name layout } } } } } `; interface ListViewsResponse { node: { views: { nodes: Array<{ id: string; name: string; layout: string; }> } } } const response = await this.factory.graphql<ListViewsResponse>(query, { projectId: data.projectId }); if (!response.node?.views?.nodes) { return []; } return response.node.views.nodes.map(view => ({ id: view.id, name: view.name, layout: view.layout.toLowerCase() as 'board' | 'table' | 'timeline' | 'roadmap', fields: [], // These would need to be fetched separately if needed sortBy: [], groupBy: undefined, filters: [] })); } catch (error) { throw this.mapErrorToMCPError(error); } }
- Tool definition including name, description, input schema reference, and usage example.export const listProjectViewsTool: ToolDefinition<ListProjectViewsArgs> = { name: "list_project_views", description: "List all views in a GitHub project", schema: listProjectViewsSchema as unknown as ToolSchema<ListProjectViewsArgs>, examples: [ { name: "List project views", description: "Get all views for a specific project", args: { projectId: "PVT_kwDOLhQ7gc4AOEbH" } } ] };
- Zod input schema validation for the tool parameters.// Schema for list_project_views tool export const listProjectViewsSchema = z.object({ projectId: z.string().min(1, "Project ID is required"), }); export type ListProjectViewsArgs = z.infer<typeof listProjectViewsSchema>;
- src/infrastructure/tools/ToolRegistry.ts:247-250 (registration)Registration of the listProjectViewsTool along with related project view tools in the central tool registry.this.registerTool(createProjectViewTool); this.registerTool(listProjectViewsTool); this.registerTool(updateProjectViewTool); this.registerTool(deleteProjectViewTool);
- src/index.ts:396-397 (handler)MCP tool dispatcher that routes 'list_project_views' calls to the ProjectManagementService implementation.case "list_project_views": return await this.service.listProjectViews(args);