Skip to main content
Glama
damonxue

OSSInsight MCP Server

list_collections

Retrieve available repository collections to analyze GitHub data for open source insights. Supports pagination with page and per-page parameters.

Instructions

List all available repository collections

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number, starting from 1
per_pageNoNumber of results per page, default is 20

Implementation Reference

  • Core handler function that fetches the list of collections from OSSInsight API, with fallback to web URL.
    async function listCollections(page: number = 1, perPage: number = 20): Promise<any> {
      try {
        // Get collections from API if available
        const collectionsData = await apiRequest('/collections', { 
          page, 
          per_page: perPage 
        });
        
        // Get web page URL for reference
        const webUrl = `${OSSINSIGHT_WEB_URL}/collections`;
        
        return {
          collections: collectionsData,
          web_url: webUrl
        };
      } catch (error) {
        // If API fails, provide just the collections web URL
        console.error(`API request failed: ${error}`);
        
        return {
          message: "API request failed. Please visit the web URL to browse collections.",
          web_url: `${OSSINSIGHT_WEB_URL}/collections`
        };
      }
    }
  • Zod schema defining optional input parameters page and per_page for pagination.
    export const ListCollectionsParamsSchema = z.object({
      page: z.number().optional().describe("Page number, starting from 1"),
      per_page: z.number().optional().describe("Number of results per page, default is 20")
    });
  • index.ts:302-306 (registration)
    Tool registration in the listTools response, specifying name, description, and input schema.
    {
      name: "list_collections",
      description: "List all available repository collections",
      inputSchema: zodToJsonSchema(ListCollectionsParamsSchema)
    },
  • Dispatcher handler case within CallToolRequest that parses args, calls listCollections, and formats response.
    case "list_collections": {
      const args = ListCollectionsParamsSchema.parse(request.params.arguments);
      const collections = await listCollections(args.page, args.per_page);
      return { content: [{ type: "text", text: JSON.stringify(collections, 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