github_activity
Retrieve recent GitHub activity, including commits, issues, pull requests, and releases, with options to limit results and include detailed information.
Instructions
Get Duyet's recent GitHub activity including commits, issues, pull requests, releases, and other public events
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_details | No | Include detailed information like commit messages and issue titles | |
| limit | No | Number of recent activities to retrieve (1-20, default: 5) |
Implementation Reference
- src/tools/github-activity.ts:24-53 (handler)The core handler function for the 'github_activity' tool. Fetches GitHub activity data, formats it for display, and returns it as text content. Includes error handling with fallback message.async ({ limit = 5, include_details = false }) => { try { const data = await getGitHubActivityData(limit, include_details); const formattedContent = formatGitHubActivityForDisplay(data); return { content: [ { type: "text", text: formattedContent, }, ], }; } catch (error) { console.error("GitHub API error:", error); const errorMessage = error instanceof Error ? error.message : "Unknown error"; const errorContent = `Error fetching GitHub activity: ${errorMessage} GitHub Profile: https://github.com/duyet`; return { content: [ { type: "text", text: errorContent, }, ], }; }
- src/tools/github-activity.ts:6-22 (schema)Zod-based input schema for the tool parameters: limit (number, 1-20, default 5) and include_details (boolean, default false).const limitSchema = z.number().min(1).max(20).optional().default(5) as any; const includeDetailsSchema = z.boolean().optional().default(false) as any; /** * Register the GitHub activity tool */ export function registerGitHubActivityTool(server: McpServer) { server.registerTool( "github_activity", { title: "GitHub Activity", description: "Get Duyet's recent GitHub activity including commits, issues, pull requests, releases, and other public events", inputSchema: { limit: limitSchema.describe("Number of recent activities to retrieve (1-20, default: 5)"), include_details: includeDetailsSchema.describe("Include detailed information like commit messages and issue titles"), },
- src/tools/github-activity.ts:12-56 (registration)Registers the 'github_activity' tool with the MCP server, defining title, description, input schema, and handler.export function registerGitHubActivityTool(server: McpServer) { server.registerTool( "github_activity", { title: "GitHub Activity", description: "Get Duyet's recent GitHub activity including commits, issues, pull requests, releases, and other public events", inputSchema: { limit: limitSchema.describe("Number of recent activities to retrieve (1-20, default: 5)"), include_details: includeDetailsSchema.describe("Include detailed information like commit messages and issue titles"), }, }, async ({ limit = 5, include_details = false }) => { try { const data = await getGitHubActivityData(limit, include_details); const formattedContent = formatGitHubActivityForDisplay(data); return { content: [ { type: "text", text: formattedContent, }, ], }; } catch (error) { console.error("GitHub API error:", error); const errorMessage = error instanceof Error ? error.message : "Unknown error"; const errorContent = `Error fetching GitHub activity: ${errorMessage} GitHub Profile: https://github.com/duyet`; return { content: [ { type: "text", text: errorContent, }, ], }; } }, ); }
- src/tools/index.ts:26-28 (registration)Top-level registration call for the github_activity tool during initialization of all tools.// Content tools registerGitHubActivityTool(server); logger.tool("github_activity", "registered");
- src/core/github.ts:175-185 (helper)Helper function called by the tool handler to fetch and cache GitHub activity data from the GitHub API.export async function getGitHubActivityData( limit = 5, includeDetails = false, ): Promise<GitHubActivityData> { const limitNum = Math.min(Math.max(limit, 1), 20); const cacheKey = `github-activity-${limitNum}-${includeDetails}`; return cacheOrFetch(cacheKey, CACHE_CONFIGS.GITHUB, () => fetchGitHubActivityData(limitNum, includeDetails), ); }