Skip to main content
Glama

get_native_component

Retrieve accessibility criteria for native mobile components, including iOS/Android implementation details, platform properties, and code examples to ensure accessible development.

Instructions

Get detailed accessibility criteria for a specific native component. Returns iOS and Android implementation details, platform-specific properties, and code examples.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesComponent name (e.g., "button", "switch", "picker")
include_code_examplesNoInclude platform-specific code examples (default: true)

Implementation Reference

  • Primary execution handler for the 'get_native_component' tool. Fetches native component data from contentLoader, serializes to JSON, handles not-found errors with suggestions.
    async function handleGetNativeComponent(args: any) {
      try {
        const componentData = await contentLoader.getComponent('native', args.component);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(componentData, null, 2),
            },
          ],
        };
      } catch (error: any) {
        const suggestions = contentLoader.getSimilarComponents('native', args.component);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  error: 'Component not found',
                  component: args.component,
                  suggestions,
                },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
  • Tool schema definition: name, description, and inputSchema used for tool listing and validation.
    {
      name: 'get_native_component',
      description: 'Get detailed accessibility criteria for a specific native component. Returns iOS and Android implementation details, platform-specific properties, and code examples.',
      inputSchema: {
        type: 'object',
        properties: {
          component: {
            type: 'string',
            description: 'Component name (e.g., "button", "switch", "picker")',
          },
          include_code_examples: {
            type: 'boolean',
            description: 'Include platform-specific code examples (default: true)',
            default: true,
          },
        },
        required: ['component'],
      },
    },
  • src/index.ts:45-92 (registration)
    Tool dispatcher registration via setRequestHandler for CallToolRequestSchema, including the switch case that routes 'get_native_component' to its handler.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        switch (name) {
          case 'list_web_components':
            return await handleListWebComponents(args);
          case 'get_web_component':
            return await handleGetWebComponent(args);
          case 'search_web_criteria':
            return await handleSearchWebCriteria(args);
          case 'list_native_components':
            return await handleListNativeComponents(args);
          case 'get_native_component':
            return await handleGetNativeComponent(args);
          case 'search_native_criteria':
            return await handleSearchNativeCriteria(args);
          case 'get_component_gherkin':
            return await handleGetComponentGherkin(args);
          case 'get_component_condensed':
            return await handleGetComponentCondensed(args);
          case 'get_component_developer_notes':
            return await handleGetComponentDeveloperNotes(args);
          case 'get_component_native_notes':
            return await handleGetComponentNativeNotes(args);
          case 'list_component_formats':
            return await handleListComponentFormats(args);
          default:
            throw new Error(`Unknown tool: ${name}`);
        }
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  error: error.message || 'An error occurred',
                },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    });
  • Secondary inline handler for 'get_native_component' in Netlify HTTP serverless function.
    case 'get_native_component': {
      const data = await contentLoader.getComponent('native', args.component);
      return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
    }

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/joe-watkins/magentaa11y-mcp-remote'

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