Skip to main content
Glama
MarySuneela

Visa Design System MCP Server

by MarySuneela

get-component-examples

Retrieve code examples for a specific component using the Visa Design System MCP Server to streamline development and ensure design consistency.

Instructions

Get code examples for a specific component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesComponent name

Implementation Reference

  • Main MCP tool handler for 'get-component-examples': validates input, delegates to ComponentService, formats JSON response with examples.
    /** * Handle get-component-examples tool call */ private async handleGetComponentExamples(args: Record<string, any>): Promise<CallToolResult> { const { name } = args; if (!name || typeof name !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'Component name is required and must be a string' ); } const examples = await this.componentService.getComponentExamples(name); return { content: [ { type: 'text', text: JSON.stringify({ component: name, examples, count: examples.length }, null, 2) } ] }; }
  • Tool registration in getToolDefinitions(): defines name, description, and input schema requiring 'name' parameter.
    { name: 'get-component-examples', description: 'Get code examples for a specific component', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Component name' } }, required: ['name'] } },
  • Input schema definition for the tool: object with required 'name' string property.
    { name: 'get-component-examples', description: 'Get code examples for a specific component', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Component name' } }, required: ['name'] } },
  • Helper method in ComponentService that retrieves the examples array from the component data.
    async getComponentExamples(name: string): Promise<ComponentExample[]> { const component = await this.getComponent(name); return component.examples; }
  • Service-level handler implementing the core logic to fetch component examples from data cache.
    async getComponentExamples(name: string): Promise<ComponentExample[]> { const component = await this.getComponent(name); return component.examples; }

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