github_activity_list_repo_events
List repository events by owner and repo, with optional pagination limits.
Instructions
List repository events
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | owner | |
| repo | Yes | repo | |
| per_page | No | The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." | |
| page | No | The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." |
Implementation Reference
- src/tools/activity.ts:145-147 (handler)Handler function for github_activity_list_repo_events that makes a GET request to /repos/{owner}/{repo}/events with optional pagination parameters.
handler: async (args: Record<string, any>) => { return githubRequest("GET", `/repos/${args.owner}/${args.repo}/events`, undefined, { per_page: args.per_page, page: args.page }); }, - src/tools/activity.ts:137-144 (schema)Input schema definition for github_activity_list_repo_events, requiring owner and repo strings, with optional per_page and page parameters.
name: "github_activity_list_repo_events", description: "List repository events", inputSchema: z.object({ owner: z.string().describe("owner"), repo: z.string().describe("repo"), per_page: z.number().optional().describe("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), page: z.number().optional().describe("The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"") }), - src/index.ts:55-100 (registration)Tools are registered in the activity category via allToolModules array, then each tool is registered with server.tool() at line 111.
const allToolModules = [ { category: "actions", tools: actionsTools }, { category: "activity", tools: activityTools }, { category: "agent-tasks", tools: agentTasksTools }, { category: "apps", tools: appsTools }, { category: "billing", tools: billingTools }, { category: "campaigns", tools: campaignsTools }, { category: "checks", tools: checksTools }, { category: "classroom", tools: classroomTools }, { category: "code-scanning", tools: codeScanningTools }, { category: "code-security", tools: codeSecurityTools }, { category: "codes-of-conduct", tools: codesOfConductTools }, { category: "codespaces", tools: codespacesTools }, { category: "copilot", tools: copilotTools }, { category: "credentials", tools: credentialsTools }, { category: "dependabot", tools: dependabotTools }, { category: "dependency-graph", tools: dependencyGraphTools }, { category: "emojis", tools: emojisTools }, { category: "enterprise-team-memberships", tools: enterpriseTeamMembershipsTools }, { category: "enterprise-team-organizations", tools: enterpriseTeamOrganizationsTools }, { category: "enterprise-teams", tools: enterpriseTeamsTools }, { category: "gists", tools: gistsTools }, { category: "git", tools: gitTools }, { category: "gitignore", tools: gitignoreTools }, { category: "hosted-compute", tools: hostedComputeTools }, { category: "interactions", tools: interactionsTools }, { category: "issues", tools: issuesTools }, { category: "licenses", tools: licensesTools }, { category: "markdown", tools: markdownTools }, { category: "meta", tools: metaTools }, { category: "migrations", tools: migrationsTools }, { category: "oidc", tools: oidcTools }, { category: "orgs", tools: orgsTools }, { category: "packages", tools: packagesTools }, { category: "private-registries", tools: privateRegistriesTools }, { category: "projects", tools: projectsTools }, { category: "pulls", tools: pullsTools }, { category: "rate-limit", tools: rateLimitTools }, { category: "reactions", tools: reactionsTools }, { category: "repos", tools: reposTools }, { category: "search", tools: searchTools }, { category: "secret-scanning", tools: secretScanningTools }, { category: "security-advisories", tools: securityAdvisoriesTools }, { category: "teams", tools: teamsTools }, { category: "users", tools: usersTools }, ]; - src/client.ts:9-59 (helper)The githubRequest helper function used by the handler to make authenticated HTTP requests to the GitHub API.
export async function githubRequest<T>( method: string, path: string, body?: Record<string, unknown>, params?: Record<string, string | number | boolean | string[] | undefined> ): Promise<T> { const url = new URL(`${BASE_URL}${path}`); if (params) { for (const [key, value] of Object.entries(params)) { if (value === undefined || value === null || value === "") continue; if (Array.isArray(value)) { url.searchParams.set(key, value.join(",")); } else { url.searchParams.set(key, String(value)); } } } const headers: Record<string, string> = { Authorization: `Bearer ${getToken()}`, Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28", "User-Agent": "github-mcp/1.0.0", }; if (body) { headers["Content-Type"] = "application/json"; } const res = await fetch(url.toString(), { method, headers, body: body ? JSON.stringify(body) : undefined, }); if (!res.ok) { const text = await res.text().catch(() => ""); let detail = text; try { const json = JSON.parse(text); detail = json.message || text; if (json.errors) detail += ` -- ${JSON.stringify(json.errors)}`; } catch {} throw new Error(`GitHub API error ${res.status}: ${detail}`); } if (res.status === 204) return {} as T; return res.json() as Promise<T>; }