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
| Name | Required | Description | Default |
|---|---|---|---|
| component | Yes | Nombre del componente de PrimeNG (ej: 'button', 'table', 'dialog') |
Implementation Reference
- src/tools/GetComponentDocTool.ts:27-57 (handler)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}...` ); } }
- src/models/ToolSchemas.ts:10-26 (schema)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"], }, }; }
- src/server/PrimeNGServer.ts:133-137 (registration)Instantiates the GetComponentDocTool instance with dependencies.this.getComponentDocTool = new GetComponentDocTool( this.scraperService, this.cacheService, this.components );
- src/server/PrimeNGServer.ts:181-181 (registration)Registers the tool schema in the MCP listTools response.createGetComponentDocSchema(this.components),
- src/server/PrimeNGServer.ts:205-207 (registration)Routes tool calls matching 'get_component_doc' to the tool's run method.case "get_component_doc": return await this.getComponentDocTool.run(args);