Skip to main content
Glama
mattyatea

Git Conflict MCP

by mattyatea

read_conflict

Read the content of a conflicted Git file to identify merge conflicts and understand differences between versions for resolution.

Instructions

Read the content of a conflicted file by its ID. (Rate limit: 5 calls per minute). You must use list_conflicts to get the ID first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the file to read (from list_conflicts).

Implementation Reference

  • The core handler function executing the "read_conflict" tool logic: checks rate limit, retrieves conflicted files, finds file by ID, reads and returns its content.
    async ({ id }) => {
        if (!rateLimiter.check("read_conflict", 5, 60 * 1000)) {
            return { content: [{ type: "text", text: "Rate limit exceeded. Please wait." }], isError: true };
        }
    
        try {
            const projectPath = state.getProjectPath();
            if (!projectPath) {
                return { content: [{ type: "text", text: "Project not initialized. Run init_project first." }], isError: true };
            }
    
            const files = await getConflictedFiles();
            const file = files.find(f => generateId(f) === id);
    
            if (!file) {
                return { content: [{ type: "text", text: "Invalid ID (file not found)." }], isError: true };
            }
    
            const fullPath = path.join(projectPath, file);
            const content = await fs.readFile(fullPath, "utf-8");
            return { content: [{ type: "text", text: content }] };
        } catch (e: any) {
            return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
        }
    }
  • Zod input schema defining the 'id' parameter for the "read_conflict" tool.
    inputSchema: z.object({
        id: z.string().describe("The ID of the file to read (from list_conflicts)."),
    }),
  • The registration function that sets up the "read_conflict" tool on the MCP server, including name, description, schema, and handler.
    export function registerReadConflict(server: McpServer) {
        server.registerTool(
            "read_conflict",
            {
                description: "Read the content of a conflicted file by its ID. (Rate limit: 5 calls per minute). You must use list_conflicts to get the ID first.",
                inputSchema: z.object({
                    id: z.string().describe("The ID of the file to read (from list_conflicts)."),
                }),
            },
            async ({ id }) => {
                if (!rateLimiter.check("read_conflict", 5, 60 * 1000)) {
                    return { content: [{ type: "text", text: "Rate limit exceeded. Please wait." }], isError: true };
                }
    
                try {
                    const projectPath = state.getProjectPath();
                    if (!projectPath) {
                        return { content: [{ type: "text", text: "Project not initialized. Run init_project first." }], isError: true };
                    }
    
                    const files = await getConflictedFiles();
                    const file = files.find(f => generateId(f) === id);
    
                    if (!file) {
                        return { content: [{ type: "text", text: "Invalid ID (file not found)." }], isError: true };
                    }
    
                    const fullPath = path.join(projectPath, file);
                    const content = await fs.readFile(fullPath, "utf-8");
                    return { content: [{ type: "text", text: content }] };
                } catch (e: any) {
                    return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
                }
            }
        );
    }
  • Invocation of the read_conflict registration within the main tools registration function.
    registerReadConflict(server);
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 and adds valuable behavioral context: it discloses a rate limit ('5 calls per minute') and the prerequisite dependency on list_conflicts. However, it doesn't describe the return format or error 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?

Two sentences, zero waste: the first states the purpose and rate limit, the second provides critical usage guidance. It's front-loaded with essential information and appropriately sized.

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 simple read operation with 1 parameter and no output schema, the description is nearly complete: it covers purpose, usage, and rate limits. The main gap is lack of output format details, but given the tool's simplicity, this is a minor omission.

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 the 'id' parameter fully. The description adds minimal value by restating that the ID comes from list_conflicts, which is already in the schema description, meeting 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 specific action ('Read the content'), target resource ('conflicted file'), and required identifier ('by its ID'), distinguishing it from siblings like list_conflicts (which lists conflicts) and resolve_conflict (which resolves them).

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?

Explicitly states when to use this tool ('You must use list_conflicts to get the ID first'), providing a clear prerequisite and distinguishing it from alternatives like init_project or post_resolve that serve different purposes.

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/mattyatea/git-conflict-mcp'

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