Skip to main content
Glama
MarySuneela

Visa Design System MCP Server

by MarySuneela

search-components

Find components in Visa's Design System by name, description, or other search criteria to access specifications and usage guidelines.

Instructions

Search components by name, description, or other criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for components

Implementation Reference

  • The primary handler function for the 'search-components' MCP tool. Validates the query argument, delegates the search to ComponentService, and returns a JSON-formatted response with search results.
    private async handleSearchComponents(args: Record<string, any>): Promise<CallToolResult> { const { query } = args; if (!query || typeof query !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'Query parameter is required and must be a string' ); } const components = await this.componentService.searchComponents(query); return { content: [ { type: 'text', text: JSON.stringify({ components, count: components.length, query }, null, 2) } ] }; }
  • The input schema and metadata definition for the 'search-components' tool, registered in the listTools response.
    name: 'search-components', description: 'Search components by name, description, or other criteria', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for components' } }, required: ['query'] } },
  • Registration of the tool handler in the main tool call switch statement within handleToolCall method.
    case 'search-components': return await this.handleSearchComponents(args);
  • The core helper method implementing the component search logic by filtering cached components based on matches in name, description, category, guidelines, and props.
    async searchComponents(query: string): Promise<Component[]> { if (!query || typeof query !== 'string') { throw this.createError('INVALID_QUERY', 'Search query must be a non-empty string'); } const cachedData = this.dataManager.getCachedData(); if (!cachedData) { throw this.createError('NO_DATA', 'No component data available'); } const searchTerm = query.toLowerCase(); return cachedData.components.filter(component => { // Search in name if (component.name.toLowerCase().includes(searchTerm)) { return true; } // Search in description if (component.description.toLowerCase().includes(searchTerm)) { return true; } // Search in category if (component.category.toLowerCase().includes(searchTerm)) { return true; } // Search in guidelines if (component.guidelines.some(guideline => guideline.toLowerCase().includes(searchTerm) )) { return true; } // Search in prop names and descriptions if (component.props.some(prop => prop.name.toLowerCase().includes(searchTerm) || prop.description.toLowerCase().includes(searchTerm) )) { return true; } return false; }); }

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/MarySuneela/mcp-vpds'

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