Skip to main content
Glama

list_project_views

Retrieve all views in a GitHub project to organize and manage project data effectively.

Instructions

List all views in a GitHub project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYes

Implementation Reference

  • The main handler function that executes the tool logic by querying GitHub GraphQL API for project views and mapping 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);
      }
    }
  • Zod schema defining the input arguments for the list_project_views tool (requires projectId).
    // 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>;
  • Imports and registers the listProjectViewsTool in the central ToolRegistry.
      listProjectViewsTool,
      updateProjectViewTool,
    
      // Milestone tools
      updateMilestoneTool,
      deleteMilestoneTool,
    
      // Sprint tools
      updateSprintTool,
      addIssuesToSprintTool,
      removeIssuesFromSprintTool,
    
      // Label tools
      createLabelTool,
      listLabelsTool,
    
      // AI task management tools
      addFeatureTool,
      generatePRDTool,
      parsePRDTool,
      getNextTaskTool,
      analyzeTaskComplexityTool,
      expandTaskTool,
      enhancePRDTool,
      createTraceabilityMatrixTool,
    } from "./ToolSchemas.js";
    
    /**
     * Central registry of all available tools
     */
    export class ToolRegistry {
      private static _instance: ToolRegistry;
      private _tools: Map<string, ToolDefinition<any>>;
    
      private constructor() {
        this._tools = new Map();
        this.registerBuiltInTools();
      }
    
      /**
       * Get the singleton instance
       */
      public static getInstance(): ToolRegistry {
        if (!ToolRegistry._instance) {
          ToolRegistry._instance = new ToolRegistry();
        }
        return ToolRegistry._instance;
      }
    
      /**
       * Register a new tool
       */
      public registerTool<T>(tool: ToolDefinition<T>): void {
        if (this._tools.has(tool.name)) {
          process.stderr.write(`Tool '${tool.name}' is already registered and will be overwritten.\n`);
        }
        this._tools.set(tool.name, tool);
      }
    
      /**
       * Get a tool by name
       */
      public getTool<T>(name: string): ToolDefinition<T> | undefined {
        return this._tools.get(name) as ToolDefinition<T> | undefined;
      }
    
      /**
       * Get all registered tools
       */
      public getAllTools(): ToolDefinition<any>[] {
        return Array.from(this._tools.values());
      }
    
      /**
       * Convert tools to MCP format for list_tools response
       */
      public getToolsForMCP(): Array<{
        name: string;
        description: string;
        inputSchema: any;
      }> {
        return this.getAllTools().map(tool => ({
          name: tool.name,
          description: tool.description,
          inputSchema: this.convertZodToJsonSchema(tool.schema),
        }));
      }
    
      /**
       * Register all built-in tools
       */
      private registerBuiltInTools(): void {
        // Register roadmap and planning tools
        this.registerTool(createRoadmapTool);
        this.registerTool(planSprintTool);
        this.registerTool(getMilestoneMetricsTool);
        this.registerTool(getSprintMetricsTool);
        this.registerTool(getOverdueMilestonesTool);
        this.registerTool(getUpcomingMilestonesTool);
    
        // Register project tools
        this.registerTool(createProjectTool);
        this.registerTool(listProjectsTool);
        this.registerTool(getProjectTool);
        this.registerTool(updateProjectTool);
        this.registerTool(deleteProjectTool);
    
        // Register milestone tools
        this.registerTool(createMilestoneTool);
        this.registerTool(listMilestonesTool);
        this.registerTool(updateMilestoneTool);
        this.registerTool(deleteMilestoneTool);
    
        // Register issue tools
        this.registerTool(createIssueTool);
        this.registerTool(listIssuesTool);
        this.registerTool(getIssueTool);
        this.registerTool(updateIssueTool);
    
        // Register sprint tools
        this.registerTool(createSprintTool);
        this.registerTool(listSprintsTool);
        this.registerTool(getCurrentSprintTool);
        this.registerTool(updateSprintTool);
        this.registerTool(addIssuesToSprintTool);
        this.registerTool(removeIssuesFromSprintTool);
    
        // Register project field tools
        this.registerTool(createProjectFieldTool);
        this.registerTool(listProjectFieldsTool);
        this.registerTool(updateProjectFieldTool);
    
        // Register project view tools
        this.registerTool(createProjectViewTool);
        this.registerTool(listProjectViewsTool);
  • Switch case dispatcher in executeToolHandler that routes the tool call to the ProjectManagementService.listProjectViews method.
    case "list_project_views":
      return await this.service.listProjectViews(args);
  • ToolDefinition object that defines the tool metadata including name, description, schema, and examples.
    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"
          }
        }
      ]
    };

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/HarshKumarSharma/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server