Skip to main content
Glama

list_projects

Retrieve and filter GitHub repository projects by state, enabling organized tracking and management of open, closed, or all project statuses efficiently.

Instructions

List projects for a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
pageNoPage number of the results
per_pageNoResults per page (max 100)
repoYesRepository name
stateNoFilter projects by state

Implementation Reference

  • The core handler function that fetches and returns the list of projects for a given GitHub repository using the GitHub API.
    export async function listProjects( github_pat: string, owner: string, repo: string, options: { state?: "open" | "closed" | "all"; per_page?: number; page?: number; } = {} ): Promise<z.infer<typeof ProjectSchema>[]> { const url = new URL(`https://api.github.com/repos/${owner}/${repo}/projects`); if (options.state) url.searchParams.append("state", options.state); if (options.per_page) url.searchParams.append("per_page", options.per_page.toString()); if (options.page) url.searchParams.append("page", options.page.toString()); const response = await githubRequest( github_pat, url.toString(), { headers: { "Accept": "application/vnd.github.inertia-preview+json", }, } ); return z.array(ProjectSchema).parse(response); }
  • Input schema definition for the list_projects tool, including both public schema and internal schema with GitHub PAT.
    export const ListProjectsSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), state: z.enum(["open", "closed", "all"]).optional().describe("Filter projects by state"), per_page: z.number().optional().describe("Results per page (max 100)"), page: z.number().optional().describe("Page number of the results"), }); export const _ListProjectsSchema = ListProjectsSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
  • src/index.ts:249-253 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema.
    { name: "list_projects", description: "List projects for a repository", inputSchema: zodToJsonSchema(projects.ListProjectsSchema), },
  • Dispatcher in the CallTool handler that invokes the listProjects function with parsed arguments.
    case "list_projects": { const args = projects._ListProjectsSchema.parse(params.arguments); const { github_pat, owner, repo, ...options } = args; const result = await projects.listProjects(github_pat, owner, repo, options); 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/MissionSquad/mcp-github'

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