Skip to main content
Glama
artem-amplemarket

Amplemarket Knowledge Base MCP Server

kb_get_collection

Retrieve collection metadata and articles from the knowledge base to access organized content using a collection ID.

Instructions

Get collection metadata and articles from the Pylon knowledge base

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCollection ID

Implementation Reference

  • The handler function that parses input arguments, fetches the collection using pylonClient.getCollection, and returns the JSON stringified result or an error message.
    export async function handleKbGetCollection(pylonClient: PylonAPI, args: unknown) {
      const params = GetCollectionParamsSchema.parse(args);
      
      try {
        const collection = await pylonClient.getCollection(params.id);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(collection, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error getting collection: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • MCP tool definition including input schema for the kb_get_collection tool.
    export const kbGetCollectionTool: Tool = {
      name: 'kb_get_collection',
      description: 'Get collection metadata and articles from the Pylon knowledge base',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'Collection ID'
          }
        },
        required: ['id']
      }
    };
  • Zod schema used for parsing and validating the input arguments in the handler.
    export const GetCollectionParamsSchema = z.object({
      id: z.string().min(1, "Collection ID cannot be empty")
    });
  • src/index.ts:39-43 (registration)
    Registration of the tool in the ListToolsRequest handler, making it discoverable.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [kbGetArticleTool, kbGetCollectionTool, kbGetArticlesTool],
      };
    });
  • src/index.ts:45-56 (registration)
    Dispatch registration in the CallToolRequest handler via switch case for 'kb_get_collection'.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      switch (request.params.name) {
        case 'amplemarket_get_article':
          return await handleKbGetArticle(pylonClient, request.params.arguments);
        case 'kb_get_collection':
          return await handleKbGetCollection(pylonClient, request.params.arguments);
        case 'amplemarket_get_all_articles':
          return await handleKbGetArticles(pylonClient, request.params.arguments);
        default:
          throw new Error(`Unknown tool: ${request.params.name}`);
      }
    });

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/artem-amplemarket/amplemarket-pylon-mcp'

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