Skip to main content
Glama

get-component-patterns

Retrieve React Native component patterns for creating buttons, cards, list items, images, and form inputs. Covers Pressable, expo-image, React.memo, React Compiler, composable patterns, and uncontrolled TextInput.

Instructions

Get React Native component patterns. Call this when creating any component: button, card, list item, image, form input. Covers Pressable, expo-image, React.memo, React Compiler, composable pattern, and uncontrolled TextInput. Use topic to get a specific section only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicNoGet a specific section only. Available: pressable, expo-image, react-memo, react-compiler, composable, uncontrolled-textinput. Omit for full content.
compactNoIf true, returns rules only without code examples. Much shorter.

Implementation Reference

  • The handler function that executes the logic for the "get-component-patterns" tool, utilizing the `resolvePattern` helper.
    export const getComponentPatterns = (topic?: string, compact?: boolean): string =>
      resolvePattern(pattern, topic, compact);
  • src/index.ts:31-49 (registration)
    Registration of the "get-component-patterns" tool in the MCP server instance.
    server.tool(
      "get-component-patterns",
      "Get React Native component patterns. Call this when creating any component: button, card, list item, image, form input. Covers Pressable, expo-image, React.memo, React Compiler, composable pattern, and uncontrolled TextInput. Use `topic` to get a specific section only.",
      {
        topic: z
          .string()
          .optional()
          .describe(
            "Get a specific section only. Available: pressable, expo-image, react-memo, react-compiler, composable, uncontrolled-textinput. Omit for full content."
          ),
        compact: z
          .boolean()
          .optional()
          .describe("If true, returns rules only without code examples. Much shorter."),
      },
      async ({ topic, compact }) => ({
        content: [{ type: "text", text: getComponentPatterns(topic, compact) }],
      })
    );
  • Zod schema definitions for the "get-component-patterns" tool inputs (topic and compact).
    {
      topic: z
        .string()
        .optional()
        .describe(
          "Get a specific section only. Available: pressable, expo-image, react-memo, react-compiler, composable, uncontrolled-textinput. Omit for full content."
        ),
      compact: z
        .boolean()
        .optional()
        .describe("If true, returns rules only without code examples. Much shorter."),
    },
  • Data structure holding the patterns content, used by the handler to return tool output.
    const pattern: PatternSections = {
      title: 'Component Patterns',
      sections,
      compactSections,
    };
Behavior3/5

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

With no annotations provided, the description carries full burden. It describes what content is available (patterns for specific components and technologies) and mentions the compact parameter behavior ('returns rules only without code examples'). However, it doesn't disclose important behavioral aspects like response format, potential size of output, error conditions, or whether this is a read-only operation.

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

Conciseness4/5

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

The description is appropriately sized with three sentences. The first sentence establishes purpose, the second provides usage context, and the third adds parameter guidance. Each sentence adds value, though the second sentence could be slightly more concise by removing the colon-separated list of component examples.

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

Completeness3/5

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

For a read-oriented tool with 2 parameters and 100% schema coverage but no output schema, the description provides adequate context about what patterns are available and when to use it. However, without annotations or output schema, it should ideally describe the response format or structure to help the agent understand what to expect from the tool's output.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds some value by mentioning 'Use `topic` to get a specific section only' and listing the available topics, which complements the schema's description. However, it doesn't provide additional semantic context beyond what's already in the well-documented schema parameters.

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 clearly states the tool's purpose: 'Get React Native component patterns' with specific examples (button, card, etc.) and technologies covered (Pressable, expo-image, etc.). It distinguishes from some siblings like 'get-api-patterns' or 'get-styling-patterns' by focusing on components, but doesn't explicitly differentiate from all similar pattern tools like 'get-navigation-patterns'.

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

Usage Guidelines4/5

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

Provides clear usage context: 'Call this when creating any component: button, card, list item, image, form input.' This gives specific scenarios for when to use the tool. However, it doesn't mention when NOT to use it or explicitly compare with alternatives among sibling tools.

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/ZaharGusyatin/react-native-expo-mcp'

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