Skip to main content
Glama

get_collection

Retrieve detailed information about a specific collection of GitHub repositories to analyze open source ecosystems and gain insights into related projects.

Instructions

Get information about a specific collection of repositories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYesCollection ID, e.g., 'open-source-database'

Implementation Reference

  • The core handler function implementing the 'get_collection' tool logic. It fetches collection data from the OSSInsight API and falls back to web scraping if the API fails.
    async function getCollection(collectionId: string): Promise<any> { try { // Get collection data from API if available const collectionData = await apiRequest(`/collections/${collectionId}`); // Get web page URL for reference const webUrl = `${OSSINSIGHT_WEB_URL}/collections/${collectionId}`; // Try to get additional data from the web page const webData = await scrapeOSSInsightPage(webUrl, { title: 'h1', description: '.collection-description', // Add more selectors as needed }); return { collection_data: collectionData, web_data: webData, web_url: webUrl }; } catch (error) { // If API fails, rely on web page data console.error(`API request failed, falling back to web scraping: ${error}`); const webUrl = `${OSSINSIGHT_WEB_URL}/collections/${collectionId}`; return { web_data: await scrapeOSSInsightPage(webUrl, { title: 'h1', description: '.collection-description', repos_count: '.repos-count', // Add more selectors as needed }), web_url: webUrl }; } }
  • Zod schema defining the input parameters for the 'get_collection' tool, specifically the collection_id.
    export const GetCollectionParamsSchema = z.object({ collection_id: z.string().describe("Collection ID, e.g., 'open-source-database'") });
  • index.ts:297-301 (registration)
    Tool registration in the list of available tools returned by ListToolsRequestSchema handler.
    { name: "get_collection", description: "Get information about a specific collection of repositories", inputSchema: zodToJsonSchema(GetCollectionParamsSchema) },
  • index.ts:336-340 (registration)
    Dispatch case in the CallToolRequestSchema handler that invokes the getCollection function.
    case "get_collection": { const args = GetCollectionParamsSchema.parse(request.params.arguments); const collection = await getCollection(args.collection_id); return { content: [{ type: "text", text: JSON.stringify(collection, 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/damonxue/mcp-ossinsight'

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