Skip to main content
Glama

get-typescript-patterns

Access TypeScript patterns for React Native development, including strict mode configuration, API response typing, route parameters, and reusable hooks. Use topic parameter to target specific sections.

Instructions

Get TypeScript patterns for React Native. Call this when writing types or interfaces. Covers strict mode config, model types, API response types, route param typing, props interface naming, store types, generics for reusable hooks, as const, discriminated unions, and type guards. Use topic to get a specific section only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicNoGet a specific section only. Available: strict-config, route-params, api-types, model-types, props-naming, store-types, generics, as-const, discriminated-unions, type-guards. Omit for full content.
compactNoIf true, returns rules only without code examples. Much shorter.

Implementation Reference

  • The `getTypescriptPatterns` function serves as the handler for the `get-typescript-patterns` tool, delegating the logic to `resolvePattern` with the predefined pattern definitions.
    export const getTypescriptPatterns = (topic?: string, compact?: boolean): string =>
      resolvePattern(pattern, topic, compact);
  • src/index.ts:215-233 (registration)
    Tool registration for `get-typescript-patterns` within the MCP server.
    server.tool(
      "get-typescript-patterns",
      "Get TypeScript patterns for React Native. Call this when writing types or interfaces. Covers strict mode config, model types, API response types, route param typing, props interface naming, store types, generics for reusable hooks, as const, discriminated unions, and type guards. Use `topic` to get a specific section only.",
      {
        topic: z
          .string()
          .optional()
          .describe(
            "Get a specific section only. Available: strict-config, route-params, api-types, model-types, props-naming, store-types, generics, as-const, discriminated-unions, type-guards. 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: getTypescriptPatterns(topic, compact) }],
      })
    );
  • Input schema definition (parameters `topic` and `compact`) for the `get-typescript-patterns` tool.
    {
      topic: z
        .string()
        .optional()
        .describe(
          "Get a specific section only. Available: strict-config, route-params, api-types, model-types, props-naming, store-types, generics, as-const, discriminated-unions, type-guards. Omit for full content."
        ),
      compact: z
        .boolean()
        .optional()
        .describe("If true, returns rules only without code examples. Much shorter."),
    },
Behavior3/5

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

With no annotations provided, the description carries the full burden. It describes what the tool returns (patterns, rules, code examples) and mentions the 'compact' parameter affects output length. However, it doesn't disclose behavioral aspects like rate limits, authentication needs, or potential side effects.

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 and front-loaded with the main purpose. The second sentence provides usage context, and the third lists coverage areas efficiently. The final sentence directly addresses parameter usage. Some redundancy exists in listing topics that appear in the schema.

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

Completeness4/5

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

For a read-only informational tool with 2 parameters and 100% schema coverage, the description is reasonably complete. It explains what the tool provides, when to use it, and gives parameter context. Without an output schema, it could better describe the return format, but the 'compact' parameter hint helps.

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

Parameters4/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 value by explaining the 'topic' parameter provides 'specific section only' and lists all available topics, giving semantic context beyond the schema's enum-like list. It also mentions the 'compact' parameter affects output length ('Much shorter'), adding useful context.

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 TypeScript patterns for React Native' and specifies it's for 'writing types or interfaces'. It distinguishes from siblings like 'get-api-patterns' and 'get-component-patterns' by focusing specifically on TypeScript patterns, though it doesn't explicitly contrast them.

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?

The description provides clear usage context: 'Call this when writing types or interfaces' and lists specific topics covered. It doesn't explicitly state when not to use it or name alternatives, but the context implies it's for TypeScript-specific guidance in React Native development.

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