Skip to main content
Glama

get_repo_analysis

Analyzes GitHub repository metrics such as activity, stars, and issues over specified time periods, providing insights into open source project performance.

Instructions

Get detailed analysis of a GitHub repository, including activity, stars, issues, and other metrics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
owner_repoYesRepository name in the format 'owner/repo'
time_periodNoTime range for analysis (optional)

Implementation Reference

  • The core handler function that performs the get_repo_analysis tool logic: fetches repo data from OSSInsight API with fallback to scraping.
    async function getRepoAnalysis(ownerRepo: string, timePeriod?: string): Promise<any> { const [owner, repo] = ownerRepo.split('/'); if (!owner || !repo) { throw new Error('Invalid repository format. Use "owner/repo"'); } try { // Get repository basic info from API const repoResponse = await apiRequest(`/repo/${owner}/${repo}`) as ApiResponse; // Extract data from response structure (which matches repo.json) const repoData = (repoResponse['data'] || repoResponse) as RepositoryData; // Create a structured response with the available data const analysis = { basic_info: { name: repoData.name, full_name: repoData.full_name, description: repoData.description, html_url: repoData.html_url, homepage: repoData.homepage, created_at: repoData.created_at, updated_at: repoData.updated_at, language: repoData.language, license: repoData.license, topics: repoData.topics }, statistics: { stars: repoData.stargazers_count, watchers: repoData.watchers_count, forks: repoData.forks_count, open_issues: repoData.open_issues_count, size: repoData.size }, owner: { login: repoData.owner?.login, type: repoData.owner?.type, html_url: repoData.owner?.html_url, avatar_url: repoData.owner?.avatar_url }, web_url: `${OSSINSIGHT_WEB_URL}/analyze/${owner}/${repo}` }; return analysis; } catch (error) { // If API fails, try to extract data from the web page console.error(`API request failed, falling back to web scraping: ${error}`); const webUrl = `${OSSINSIGHT_WEB_URL}/analyze/${owner}/${repo}`; return { message: "API request failed. Falling back to web scraping.", web_data: await scrapeOSSInsightPage(webUrl, { title: 'h1', stars: '.stars-count', forks: '.forks-count', open_issues: '.issues-count', // Add more selectors as needed }), web_url: webUrl }; } }
  • Zod schema defining the input parameters for the get_repo_analysis tool.
    export const GetRepoAnalysisParamsSchema = z.object({ owner_repo: z.string().describe("Repository name in the format 'owner/repo'"), time_period: z.enum(['last_28_days', 'last_90_days', 'last_year', 'all_time']).optional() .describe("Time range for analysis (optional)") });
  • index.ts:288-291 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and input schema.
    name: "get_repo_analysis", description: "Get detailed analysis of a GitHub repository, including activity, stars, issues, and other metrics.", inputSchema: zodToJsonSchema(GetRepoAnalysisParamsSchema) },
  • index.ts:324-328 (registration)
    Tool invocation in the CallToolRequestSchema switch dispatcher.
    case "get_repo_analysis": { const args = GetRepoAnalysisParamsSchema.parse(request.params.arguments); const analysis = await getRepoAnalysis(args.owner_repo, args.time_period); return { content: [{ type: "text", text: JSON.stringify(analysis, null, 2) }] }; }

Other Tools

Related Tools

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/damonxue/mcp-ossinsight'

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