Skip to main content
Glama
patrickkabwe

React Native MCP Server

by patrickkabwe

Get React Native Diff

get-react-native-diff

Generate a detailed upgrade diff between React Native versions to identify required changes in dependencies, native configurations, project files, and troubleshooting steps.

Instructions

Gets the React Native diff between the current version and the user provided version. This diff will show all changes needed to upgrade React Native, including:

  • Package.json dependencies and their versions

  • iOS configuration changes (Podfile, xcodeproj settings)

  • Android configuration (build.gradle, settings.gradle)

  • Project structure changes

  • Binary files that need to be updated

  • Template files modifications

  • Native code changes

  • Troubleshooting steps if any

If no fromVersion is provided, the current version from package.json will be used. The diff follows standard git diff format and should be carefully analyzed to:

  1. Update all dependencies to compatible versions

  2. Apply configuration changes while preserving custom settings and user defined code

  3. Handle binary file updates appropriately

  4. Maintain existing customizations in native code and ts/js files

  5. Update build tools versions (Gradle, CocoaPods, etc) with the correct version from the diff using specific cmds

  6. Preserve any local modifications to template files

  7. Please add the end of the process give instruction on the troubleshooting steps if any(Please detect user's package manager and run the correct cmd):

    • DELETE Pod and Podfile.lock file in iOS folder

    • Run pod install to prevent errors in iOS folder

    • Run this cmd to update android binary ./gradlew wrapper --gradle-version {{CURRENT_GRADLE_VERSION_FROM_DIFF}} —distribution-type {{DISTRIBUTION_TYPE_FROM_DIFF}} in android folder

    • Run {{CURRENT_PACKAGE_MANAGER}} install to install the correct version of the dependencies

YOU MUST call get-react-native-stable-version tool to get the stable version of React Native before calling this tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromVersionNoThe version of React Native to get the diff from
toVersionYesThe version of React Native to get the diff to

Implementation Reference

  • The MCP tool handler function that takes fromVersion and toVersion, calls getDiff service, and returns the diff as text content.
    async ({ fromVersion, toVersion }) => {
        const diffData = await getDiff(fromVersion, toVersion);
    
        return {
            content: [{ type: "text", text: diffData }]
        }
    })
  • Zod input schema defining parameters for the tool: optional fromVersion and required toVersion.
    inputSchema: {
        fromVersion: z.string().describe("The current React Native version to compare from (defaults to version in package.json)"),
        toVersion: z.string().describe("The target React Native version to upgrade to")
    }
  • src/tools.ts:89-161 (registration)
    Full registration of the 'get-react-native-diff' tool with title, description, schema, and handler on the MCP server.
    server.registerTool('get-react-native-diff', {
        title: "Get React Native Diff",
        description: `Gets the React Native diff between the current version and the user provided version.
    
    OVERVIEW:
    This diff will show all changes needed to upgrade React Native, including:
    • Package.json dependencies and their versions
    • iOS configuration changes (Podfile, xcodeproj settings)
    • Android configuration (build.gradle, settings.gradle)
    • Project structure changes
    • Binary files that need to be updated
    • Template files modifications
    • Native code changes
    • Troubleshooting steps if any
    
    USAGE:
    • If no fromVersion is provided, the current version from package.json will be used
    • The diff follows standard git diff format and should be carefully analyzed
    
    ANALYSIS STEPS:
    1. Review the diff to identify dependency version changes
    2. Carefully analyze configuration changes in iOS and Android files
       • Preserve custom settings in Podfile, build.gradle, etc.
       • Keep user-defined code blocks intact
       • Only update version numbers and required configurations
    3. Handle binary and template file updates
       • Note which binary files need updating
       • Back up modified template files before updating
       • Merge changes while preserving customizations
    4. Maintain code integrity
       • Preserve custom code in native iOS/Android files
       • Keep modifications in JavaScript/TypeScript files (App.tsx, etc.)
       • Only update required React Native specific code
    5. Update build tooling
       • Match Gradle version from diff
       • Update CocoaPods version if specified
       • Keep existing build customizations
    6. Package management
       • Only update versions of existing dependencies
       • Do not add new packages
       • Maintain current package structure
       • Preserve custom package configurations
       • Existing package version should be the same in all package.json files
       • DO NOT fall back to rc versions, always use the stable version of React Native unless the user explicitly asks for a rc version.
    
    TROUBLESHOOTING STEPS:
    At the end of the process, provide instructions for troubleshooting steps (detect user's package manager and run the correct command):
    • DELETE Pod and Podfile.lock file in iOS folder
    • Run pod install to prevent errors in iOS folder
    • Run this command to update android binary: ./gradlew wrapper --gradle-version {{CURRENT_GRADLE_VERSION_FROM_DIFF}} --distribution-type {{DISTRIBUTION_TYPE_FROM_DIFF}} in android folder
    • Run {{CURRENT_PACKAGE_MANAGER}} install to install the correct version of the dependencies
    
    IMPORTANT NOTES:
    • Make sure not to edit existing ts/js files unless it's necessary.
    • Make sure not to add new packages, only update the existing ones based on the diff.
    • Make sure to only update package.json for dependencies which are defined in the diff.
    • YOU MUST call "get-stable-version" tool to get the stable version of React Native before calling this tool.
    • DO NOT fallback to rc versions, always use the stable version of React Native unless the user explicitly asks for a rc version.
    • If no diff exit and inform the user that the diff is empty, you can't proceed with the upgrade.
    • If a user asked to provide a version, call the "get-user-version" tool to get the version of React Native that the user wants to upgrade to.
        `,
        inputSchema: {
            fromVersion: z.string().describe("The current React Native version to compare from (defaults to version in package.json)"),
            toVersion: z.string().describe("The target React Native version to upgrade to")
        }
    },
        async ({ fromVersion, toVersion }) => {
            const diffData = await getDiff(fromVersion, toVersion);
    
            return {
                content: [{ type: "text", text: diffData }]
            }
        })
  • Core helper function that fetches the git diff between two React Native versions from the rn-diff-purge GitHub repo, with fallback if direct diff fails.
    export const getDiff = async (currentVersion: string, toVersion: string): Promise<string> => {
        const url = `https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/${currentVersion}..${toVersion}.diff`
        const response = await fetch(url);
        if (!response.ok) {
            console.error(`Failed to fetch diff for ${currentVersion} to ${toVersion} let's try getting diff for ${toVersion} to ${currentVersion}`);
            const diff = await getDiff(toVersion, currentVersion);
            return diff;
        }
        const diffData = await response.text();
        return diffData;
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: the tool outputs a diff in 'standard git diff format,' requires careful analysis with specific steps (e.g., updating dependencies, preserving customizations), and includes troubleshooting instructions (e.g., deleting Pod files, running commands). However, it lacks details on error handling or rate limits, preventing a perfect score.

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

Conciseness2/5

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

The description is overly verbose and poorly structured. It mixes high-level purpose with detailed implementation steps and troubleshooting commands in a single block, making it hard to parse. Sentences like 'Please add the end of the process give instruction on the troubleshooting steps if any' are grammatically awkward and reduce clarity. It could be significantly streamlined for better readability.

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?

Given the tool's complexity (version diffing with multiple configuration aspects) and lack of annotations or output schema, the description does a good job of covering essential context. It explains what the diff includes, how to use it, and post-processing steps. However, the absence of an output schema means the description should ideally detail the return format more explicitly, which is only partially addressed by mentioning 'standard git diff format.'

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 schema already documents both parameters (fromVersion and toVersion). The description adds some context by explaining default behavior ('If no fromVersion is provided, the current version from package.json will be used'), but does not provide additional syntax or format details beyond what the schema offers. This meets the baseline for high schema coverage.

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

Purpose5/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: 'Gets the React Native diff between the current version and the user provided version.' It specifies the verb 'gets' and resource 'React Native diff,' and distinguishes it from its sibling 'get-react-native-stable-version' by explicitly stating that tool must be called first. The detailed list of what the diff includes (package.json, iOS/Android configs, etc.) further clarifies scope.

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

Usage Guidelines5/5

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

The description provides explicit usage guidelines: it states 'YOU MUST call get-react-native-stable-version tool to get the stable version of React Native before calling this tool,' which directly addresses when to use this tool versus alternatives. It also specifies conditions like 'If no fromVersion is provided, the current version from package.json will be used,' offering clear context for parameter handling.

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/patrickkabwe/rn-mcp'

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