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
| Name | Required | Description | Default |
|---|---|---|---|
| component | Yes | Component name (e.g., "button", "switch", "picker") | |
| include_code_examples | No | Include platform-specific code examples (default: true) |
Implementation Reference
- src/index.ts:189-221 (handler)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, }; }
- src/tool-definitions.ts:73-91 (schema)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, }; } });
- netlify/functions/api.js:44-47 (handler)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) }] }; }