Skip to main content
Glama
lallen30
by lallen30

list_available_examples

Retrieve categorized code samples using the MCP protocol to access BluestoneApps React Native examples, aiding developers in implementing coding standards efficiently.

Instructions

List all available code examples by category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that executes the list_available_examples tool. It calls the listAvailableExamples helper, stringifies the result as JSON, and returns it as text content, with error handling.
    async () => { try { const examples = listAvailableExamples(); return { content: [ { type: "text", text: JSON.stringify(examples, null, 2), }, ], }; } catch (err) { console.error("Error listing available examples:", err); return { content: [ { type: "text", text: `Error listing available examples: ${err}`, }, ], }; } },
  • src/index.ts:586-614 (registration)
    The MCP server.tool registration for the list_available_examples tool, including name, description, empty input schema, and handler function.
    server.tool( "list_available_examples", "List all available code examples by category", {}, async () => { try { const examples = listAvailableExamples(); return { content: [ { type: "text", text: JSON.stringify(examples, null, 2), }, ], }; } catch (err) { console.error("Error listing available examples:", err); return { content: [ { type: "text", text: `Error listing available examples: ${err}`, }, ], }; } }, );
  • Helper function that lists all available code examples by scanning the react-native code-examples directories for components, hooks, services, screens, and themes, collecting filenames without extensions.
    function listAvailableExamples() { const examples: Record<string, string[]> = { components: [], hooks: [], services: [], screens: [], themes: [] }; const categories = [ { key: "components", dir: "components" }, { key: "hooks", dir: "hooks" }, { key: "services", dir: "services" }, { key: "screens", dir: "screens" }, { key: "themes", dir: "theme" } ]; const extensions = ['.js', '.jsx', '.ts', '.tsx']; for (const category of categories) { const dirPath = path.join(CODE_EXAMPLES_DIR, "react-native", category.dir); if (fs.existsSync(dirPath)) { for (const ext of extensions) { const files = glob.sync(`${dirPath}/**/*${ext}`); for (const filePath of files) { const fileName = path.basename(filePath); const fileNameNoExt = path.basename(fileName, path.extname(fileName)); examples[category.key].push(fileNameNoExt); } } } } return 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/lallen30/mcp-remote-server'

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