Skip to main content
Glama
lallen30

BluestoneApps MCP Remote Server

by lallen30

get_screen_example

Retrieve React Native screen code examples to implement UI components following BluestoneApps coding standards.

Instructions

Get a React Native screen example

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
screen_nameYesScreen Name

Implementation Reference

  • Registration and inline handler implementation for the 'get_screen_example' tool. Handles input validation, fetches screen example code from files with exact and fuzzy matching.
    server.tool(
      "get_screen_example",
      "Get a React Native screen example",
      {
        screen_name: z.string().describe("Screen Name"),
      },
      async ({ screen_name }) => {
        if (!screen_name) {
          return {
            content: [
              {
                type: "text",
                text: "Screen name not specified",
              },
            ],
          };
        }
        
        try {
          // First try exact match
          const result = getExampleContent("screens", screen_name);
          
          if (result.error) {
            // Try to find by fuzzy match
            const screensDir = path.join(CODE_EXAMPLES_DIR, "react-native", "screens");
            const closestMatch = findClosestMatch(screensDir, screen_name);
            
            if (closestMatch) {
              const fuzzyResult = getExampleContent("screens", closestMatch);
              return {
                content: [
                  {
                    type: "text",
                    text: fuzzyResult.content?.[0] ?? fuzzyResult.error ?? "Error: No content available",
                  },
                ],
              };
            } else {
              return {
                content: [
                  {
                    type: "text",
                    text: `Screen ${screen_name} not found`,
                  },
                ],
              };
            }
          }
          
          return {
            content: [
              {
                type: "text",
                text: result.content?.[0] ?? result.error ?? "Error: No content available",
              },
            ],
          };
        } catch (err) {
          console.error(`Error getting screen example ${screen_name}:`, err);
          return {
            content: [
              {
                type: "text",
                text: `Error getting screen example: ${err}`,
              },
            ],
          };
        }
      },
    );
  • Helper function to retrieve content from example files in the code-examples directory by subcategory and filename.
    function getExampleContent(subcategory: string, filename: string): { content?: string[]; path?: string; error?: string } {
      const searchDir = path.join(CODE_EXAMPLES_DIR, "react-native", subcategory);
      
      const filePath = findFileInSubdirectories(searchDir, filename);
      
      if (!filePath || !fs.existsSync(filePath)) {
        return { error: `Example ${filename} not found` };
      }
      
      try {
        const content = fs.readFileSync(filePath, 'utf8');
        return {
          content: [content],
          path: path.relative(BASE_DIR, filePath)
        };
      } catch (err) {
        console.error(`Error reading example ${filename}:`, err);
        return { error: `Error reading example ${filename}` };
      }
    }
  • Helper function for fuzzy matching filenames containing the search term within a directory.
    function findClosestMatch(directory: string, searchName: string, extensions: string[] = ['.js', '.jsx', '.ts', '.tsx']) {
      if (!fs.existsSync(directory)) return null;
      
      let closestMatch = null;
      
      for (const ext of extensions) {
        const files = glob.sync(`${directory}/**/*${ext}`);
        
        for (const filePath of files) {
          const fileName = path.basename(filePath);
          const fileNameNoExt = path.basename(fileName, path.extname(fileName));
          
          if (fileNameNoExt.toLowerCase().includes(searchName.toLowerCase())) {
            closestMatch = fileNameNoExt;
            break;
          }
        }
        
        if (closestMatch) break;
      }
      
      return closestMatch;
    }
  • Zod schema for the tool input parameter 'screen_name'.
    {
      screen_name: z.string().describe("Screen Name"),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does ('Get a React Native screen example') without explaining what 'Get' entails—whether it returns code snippets, documentation, examples with specific characteristics, or how it handles errors. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and uses clear, direct language. Every word earns its place, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a tool that retrieves examples (which could involve various formats or constraints), the description is incomplete. No annotations exist to clarify behavior, and there's no output schema to explain return values. The description doesn't address what kind of example is returned, potential limitations, or error handling, leaving significant gaps for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'screen_name' documented as 'Screen Name'. The description adds no additional meaning beyond this, as it doesn't clarify what constitutes a valid screen name, provide examples, or explain the parameter's role. With high schema coverage, the baseline score of 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get a React Native screen example' clearly states the verb ('Get') and resource ('React Native screen example'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'get_component_example' or 'list_available_examples', which appear related but have different scopes. The description is specific but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_component_example' and 'list_available_examples' that seem related to React Native examples, there's no indication of when this tool is appropriate versus those others. No context, exclusions, or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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