Skip to main content
Glama

list_collections

Retrieve all repository collections with pagination support. Use this tool to explore and analyze GitHub data for open source ecosystems through the OSSInsight MCP Server.

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

  • The core handler function that fetches the list of collections from the OSSInsight API endpoint '/collections' with pagination support, includes error handling with fallback 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 pagination parameters (page, per_page) for the list_collections tool input.
    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 ListToolsRequest handler, specifying name, description, and input schema.
    { name: "list_collections", description: "List all available repository collections", inputSchema: zodToJsonSchema(ListCollectionsParamsSchema) },
  • Dispatcher case in the CallToolRequestSchema handler that parses arguments, calls the listCollections function, and formats the 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) }] }; }

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