Skip to main content
Glama

get_usage

Retrieve usage documentation for Basecoat UI components to understand implementation details and proper integration methods.

Instructions

Get usage documentation for a component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesComponent name (e.g., "button", "card", "input")

Implementation Reference

  • Core handler function that implements the logic for the 'get_usage' tool by searching for and reading usage documentation Markdown files for the specified component across different categories.
    async getUsageDocumentation(componentName) {
      const usageCategories = ['forms', 'navigation', 'feedback', 'interactive', 'layout'];
    
      for (const category of usageCategories) {
        const usageFile = `${componentName}-usage.md`;
        const usagePath = path.join(__dirname, 'usage', category, usageFile);
    
        try {
          const content = await fs.readFile(usagePath, 'utf-8');
          return {
            component: componentName,
            category: category,
            documentation: content.trim()
          };
        } catch (error) {
          // Continue to next category
          continue;
        }
      }
    
      throw new Error(`Usage documentation for '${componentName}' not found`);
    }
  • server.js:191-204 (registration)
    Registration of the 'get_usage' tool in the list of available tools, including name, description, and input schema.
    {
      name: 'get_usage',
      description: 'Get usage documentation for a component',
      inputSchema: {
        type: 'object',
        properties: {
          component: {
            type: 'string',
            description: 'Component name (e.g., "button", "card", "input")',
          },
        },
        required: ['component'],
      },
    },
  • Dispatch handler in the CallToolRequestSchema that invokes getUsageDocumentation and returns the documentation as text content.
    case 'get_usage': {
      const usage = await this.getUsageDocumentation(args.component);
      return {
        content: [
          {
            type: 'text',
            text: usage.documentation,
          },
        ],
      };
    }
  • Input schema definition for the 'get_usage' tool, specifying the required 'component' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        component: {
          type: 'string',
          description: 'Component name (e.g., "button", "card", "input")',
        },
      },
      required: ['component'],
    },

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