get-components
Retrieve components from Visa Design System with options to filter by category or name, streamlining access to design resources for development.
Instructions
Get all components with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter components by category | |
| name | No | Filter components by name (partial match) |
Implementation Reference
- src/mcp-server.ts:441-456 (handler)MCP tool handler function that executes get-components logic by delegating to ComponentService and formatting the JSON response.private async handleGetComponents(args: Record<string, any>): Promise<CallToolResult> { const components = await this.componentService.getComponents(args); return { content: [ { type: 'text', text: JSON.stringify({ components, count: components.length, filters: args }, null, 2) } ] }; }
- src/mcp-server.ts:171-187 (schema)Schema definition for the get-components tool, including input parameters for filtering by category and name.{ name: 'get-components', description: 'Get all components with optional filtering', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Filter components by category' }, name: { type: 'string', description: 'Filter components by name (partial match)' } } } },
- src/mcp-server.ts:300-301 (registration)Registration of the tool handler in the main tool call switch statement.case 'get-components': return await this.handleGetComponents(args);
- Core helper function that retrieves components from the data manager cache and applies optional filters.async getComponents(options?: ComponentSearchOptions): Promise<Component[]> { const cachedData = this.dataManager.getCachedData(); if (!cachedData) { throw this.createError('NO_DATA', 'No component data available', [ 'Ensure data files are loaded', 'Check data directory configuration' ]); } let components = cachedData.components; // Apply filters if provided if (options) { components = this.filterComponents(components, options); } return components; }