Skip to main content
Glama

get_project_v2

Retrieve detailed GitHub project V2 data using GraphQL API by providing the project's node ID. Integrates with GitHub MCP Server for enhanced project management.

Instructions

Get details of a GitHub project V2 using GraphQL API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe node ID of the project

Implementation Reference

  • The main handler function that executes the get_project_v2 tool logic by querying GitHub GraphQL API for project V2 details.
    export async function getProjectV2(id: string) {
      try {
        const query = `
          query($id: ID!) {
            node(id: $id) {
              ... on ProjectV2 {
                id
                title
                shortDescription
                url
                closed
                createdAt
                updatedAt
                number
                owner {
                  __typename
                  ... on Organization {
                    login
                  }
                  ... on User {
                    login
                  }
                }
                fields(first: 20) {
                  nodes {
                    ... on ProjectV2Field {
                      id
                      name
                    }
                    ... on ProjectV2SingleSelectField {
                      id
                      name
                      options {
                        id
                        name
                        color
                      }
                    }
                  }
                }
                views(first: 20) {
                  nodes {
                    id
                    name
                    layout
                  }
                }
              }
            }
          }
        `;
    
        const variables = { id };
        const response = await graphqlRequest(query, variables);
    
        return response.data.node;
      } catch (error) {
        if (error instanceof GitHubError) {
          throw error;
        }
    
        throw new GitHubError(
          `Failed to get project v2: ${(error as Error).message}`,
          500,
          { error: (error as Error).message }
        );
      }
    }
  • Zod schema defining the input for get_project_v2: requires 'id' as string (node ID of the project).
    export const GetProjectV2Schema = z.object({
      id: z.string().describe("The node ID of the project")
    });
  • index.ts:275-279 (registration)
    Tool registration in the MCP server: defines name, description, and input schema for get_project_v2.
    {
      name: "get_project_v2",
      description: "Get details of a GitHub project V2 using GraphQL API",
      inputSchema: zodToJsonSchema(projectsV2.GetProjectV2Schema),
    },
  • Dispatcher handler case in the main CallToolRequest handler that parses args and delegates to projectsV2.getProjectV2.
    case "get_project_v2": {
      const args = projectsV2.GetProjectV2Schema.parse(request.params.arguments);
      const result = await projectsV2.getProjectV2(args.id);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }

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/tuanle96/mcp-github'

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