Skip to main content
Glama

get_project

Retrieve detailed information about a specific GitHub project by providing the repository owner, repository name, and project number to streamline project management and tracking.

Instructions

Get details about a specific project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
project_numberYesThe project number
repoYesRepository name

Implementation Reference

  • Core handler function that retrieves a specific GitHub project by owner, repo, and project number by listing all projects in the repo and filtering.
    export async function getProject(owner: string, repo: string, projectNumber: number) {
        try {
            const url = `https://api.github.com/repos/${owner}/${repo}/projects`;
    
            const projects = await githubRequest(url) as any[];
    
            // Tìm project theo number
            const project = projects.find((p: any) => p.number === projectNumber);
    
            if (!project) {
                throw new GitHubError(`Project with number ${projectNumber} not found`, 404, { message: `Project ${projectNumber} not found` });
            }
    
            return project;
        } catch (error) {
            if (error instanceof GitHubError) {
                throw error;
            }
    
            throw new GitHubError(`Failed to get project: ${(error as Error).message}`, 500, { error: (error as Error).message });
        }
    }
  • Zod schema defining the input parameters for the get_project tool.
    export const GetProjectSchema = z.object({
        owner: z.string().describe("Repository owner (username or organization)"),
        repo: z.string().describe("Repository name"),
        project_number: z.number().describe("The project number"),
    });
  • index.ts:206-208 (registration)
    Tool registration in the MCP server's list of tools, specifying name, description, and input schema.
    name: "get_project",
    description: "Get details about a specific project",
    inputSchema: zodToJsonSchema(projects.GetProjectSchema),
  • MCP request handler case that parses arguments, calls the getProject function, and formats the response.
    case "get_project": {
      const args = projects.GetProjectSchema.parse(request.params.arguments);
      const result = await projects.getProject(
        args.owner,
        args.repo,
        args.project_number
      );
      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