github_activity
Retrieve recent GitHub activity including commits, issues, pull requests, and releases to track development progress and contributions.
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 |
|---|---|---|---|
| limit | No | Number of recent activities to retrieve (1-20, default: 5) | |
| include_details | No | Include detailed information like commit messages and issue titles |
Implementation Reference
- src/tools/github-activity.ts:28-59 (handler)The handler function for the 'github_activity' tool. It fetches the GitHub activity data using getGitHubActivityData, formats it, and returns it as text content. Handles errors gracefully.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:19-26 (schema)Zod-based input schema definition for the tool parameters: limit (1-20, default 5) and include_details (boolean, default false).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/index.ts:27-27 (registration)Top-level registration call that invokes the tool registration during server initialization.registerGitHubActivityTool(server);
- src/tools/github-activity.ts:12-60 (registration)The registerGitHubActivityTool function that calls server.registerTool('github_activity', ...) including title, description, 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/core/github.ts:167-177 (helper)Main helper function to get cached GitHub activity data, called by the tool handler. Applies limits and uses cache.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), ); }