get_component_doc
Retrieve complete PrimeNG component documentation including properties, events, and methods for Angular UI development.
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)The execute method implements the core logic of the get_component_doc tool: validates input, checks cache, scrapes documentation if needed, caches result, and formats output.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)Defines the input schema for the get_component_doc tool, including component name with enum validation from available components.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 required services and components list during server initialization.this.getComponentDocTool = new GetComponentDocTool( this.scraperService, this.cacheService, this.components );
- src/server/PrimeNGServer.ts:181-181 (registration)Registers the dynamic schema for get_component_doc in the MCP list tools response.createGetComponentDocSchema(this.components),
- src/server/PrimeNGServer.ts:205-206 (registration)Handles incoming calls to get_component_doc by invoking the tool's run method.case "get_component_doc": return await this.getComponentDocTool.run(args);