Skip to main content
Glama

get_category

Retrieve all UI components from a specific category in the Basecoat UI library, including forms, navigation, feedback, interactive, and layout elements, to build accessible interfaces.

Instructions

Get all components in a specific category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory name (forms, navigation, feedback, interactive, layout)

Implementation Reference

  • The main handler for the 'get_category' tool in the switch statement. It calls the helper getComponentsByCategory, formats a markdown list of components in the category, and returns it as tool response.
    case 'get_category': {
      const categoryData = await this.getComponentsByCategory(args.category);
      let output = `# ${categoryData.category.charAt(0).toUpperCase() + categoryData.category.slice(1)} Components\n\n`;
    
      for (const component of categoryData.components) {
        output += `- **${component.name}** (${component.file})\n`;
      }
    
      return {
        content: [
          {
            type: 'text',
            text: output,
          },
        ],
      };
    }
  • Supporting helper method that filters and returns components for a specific category, with validation for category existence.
    async getComponentsByCategory(category) {
      const components = await this.getComponentsList();
    
      if (!components[category]) {
        throw new Error(`Category '${category}' not found. Available categories: ${Object.keys(components).join(', ')}`);
      }
    
      return {
        category: category,
        components: components[category]
      };
    }
  • server.js:235-248 (registration)
    Tool registration entry in the ListTools handler, defining the tool's name, description, and input schema.
    {
      name: 'get_category',
      description: 'Get all components in a specific category',
      inputSchema: {
        type: 'object',
        properties: {
          category: {
            type: 'string',
            description: 'Category name (forms, navigation, feedback, interactive, layout)',
          },
        },
        required: ['category'],
      },
    },
  • Input schema definition for the 'get_category' tool, specifying the required 'category' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        category: {
          type: 'string',
          description: 'Category name (forms, navigation, feedback, interactive, layout)',
        },
      },
      required: ['category'],
    },

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/GustavoGomezPG/basecoat-mcp'

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