Skip to main content
Glama

get_component_doc

Retrieve complete PrimeNG component documentation including properties, events, and methods to understand Angular UI component usage.

Instructions

Obtiene la documentación completa de un componente de PrimeNG incluyendo propiedades, eventos y métodos

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesNombre del componente de PrimeNG (ej: 'button', 'table', 'dialog')

Implementation Reference

  • Core handler logic: validates input, checks cache, scrapes component doc if needed, caches result, formats and returns response or error with suggestions.
    async execute(args: Record<string, any>): Promise<ToolResponse> {
      const component = args.component as string;
    
      if (!component) {
        return this.createErrorResponse('Component name is required');
      }
    
      // Check cache first
      const cachedDoc = await this.cacheService.get(component);
      if (cachedDoc) {
        logger.info(`Returning cached documentation for ${component}`);
        return this.createResponse(formatComponentDoc(cachedDoc));
      }
    
      // Scrape documentation
      try {
        const doc = await this.scraperService.scrapeComponentDoc(component);
    
        // Cache the result
        await this.cacheService.set(component, doc);
    
        return this.createResponse(formatComponentDoc(doc));
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        const suggestion = this.availableComponents.slice(0, 10).join(', ');
    
        return this.createErrorResponse(
          `Failed to get documentation for ${component}: ${errorMessage}\n\nTry one of these: ${suggestion}...`
        );
      }
    }
  • Input schema definition for the tool, specifying required 'component' parameter with enum validation.
    export function createGetComponentDocSchema(components: string[]): Tool {
      return {
        name: "get_component_doc",
        description: "Obtiene la documentación completa de un componente de PrimeNG incluyendo propiedades, eventos y métodos",
        inputSchema: {
          type: "object",
          properties: {
            component: {
              type: "string",
              description: "Nombre del componente de PrimeNG (ej: 'button', 'table', 'dialog')",
              enum: components,
            },
          },
          required: ["component"],
        },
      };
    }
  • Instantiates the GetComponentDocTool instance with dependencies.
    this.getComponentDocTool = new GetComponentDocTool(
      this.scraperService,
      this.cacheService,
      this.components
    );
  • Registers the tool schema in the MCP listTools response.
    createGetComponentDocSchema(this.components),
  • Routes tool calls matching 'get_component_doc' to the tool's run method.
    case "get_component_doc":
      return await this.getComponentDocTool.run(args);

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/hnkatze/PrimeNG_MCP'

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