Skip to main content
Glama
mattyatea

Git Conflict MCP

by mattyatea

resolve_conflict

Request Git merge conflict resolution by ID or file path for human review through WebUI. Supports content, delete/modify conflicts with resolution types and safety checks.

Instructions

Request conflict resolution by its ID or file path. The actual resolution will be performed by a human through the WebUI. Supports different resolution types for various conflict scenarios (content conflicts, delete/modify conflicts, etc.). You must run post_resolve before running this tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoThe ID of the file to resolve (from list_conflicts).
pathNoThe file path to resolve.
typeNoResolution type. Default is 'resolve'.resolve
reasonNoThe reason why this resolution is valid.
forceNoForce resolution, bypassing the safety check.

Implementation Reference

  • The handler function that implements the core logic of the 'resolve_conflict' tool. It identifies the conflicted file, adds a pending resolution to the WebUI, and returns a status message.
    async ({ id, path: filePath, type, reason, force }) => {
        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();
            let fileToResolve: string | undefined;
    
            if (id) {
                fileToResolve = files.find(f => generateId(f) === id);
                if (!fileToResolve) {
                    return { content: [{ type: "text", text: "Invalid ID." }], isError: true };
                }
            } else if (filePath) {
                let normalizedPath = filePath;
                if (path.isAbsolute(filePath)) {
                    normalizedPath = path.relative(projectPath, filePath);
                }
                if (files.includes(normalizedPath)) {
                    fileToResolve = normalizedPath;
                } else {
                    return { content: [{ type: "text", text: `File not found in conflicted files. Searched for: ${normalizedPath}` }], isError: true };
                }
            }
    
            if (!fileToResolve) {
                return { content: [{ type: "text", text: "Could not determine file to resolve. Please provide id or path." }], isError: true };
            }
    
            const absolutePath = path.join(projectPath, fileToResolve);
            const resolutionType = type || "resolve";
    
            const result = await addPendingResolve({
                filePath: fileToResolve,
                absolutePath,
                projectPath,
                type: resolutionType,
                reason,
            });
    
            if (!result.success) {
                return { content: [{ type: "text", text: `Error: ${result.error}` }], isError: true };
            }
    
            // Check for status if returned by addPendingResolve (need to cast until typed)
            const status = (result as any).status;
            let msg = `Request sent!\n\nFile: ${fileToResolve}`;
            if (status === 'draft') {
                msg += `\n\nWARNING: The resolution reason was too generic. This item has been marked as 'Draft' and will NOT appear in the review list until the reason is updated.`;
            }
    
            return {
                content: [{
                    type: "text",
                    text: msg
                }]
            };
    
        } catch (e: any) {
            return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
        }
    }
  • Zod input schema defining parameters for the 'resolve_conflict' tool: id, path, type, reason, force.
    inputSchema: z.object({
        id: z.string().optional().describe("The ID of the file to resolve (from list_conflicts)."),
        path: z.string().optional().describe("The file path to resolve."),
        type: z.enum(["resolve", "delete", "add"]).optional().default("resolve").describe("Resolution type. Default is 'resolve'."),
        reason: z.string().optional().describe("The reason why this resolution is valid."),
        force: z.boolean().optional().describe("Force resolution, bypassing the safety check."),
    }),
  • The registration function that sets up the 'resolve_conflict' tool on the MCP server, including name, description, schema, and handler.
    export function registerResolveConflict(server: McpServer) {
        server.registerTool(
            "resolve_conflict",
            {
                description: "Request conflict resolution by its ID or file path. The actual resolution will be performed by a human through the WebUI. Supports different resolution types for various conflict scenarios (content conflicts, delete/modify conflicts, etc.). You must run post_resolve before running this tool.",
                inputSchema: z.object({
                    id: z.string().optional().describe("The ID of the file to resolve (from list_conflicts)."),
                    path: z.string().optional().describe("The file path to resolve."),
                    type: z.enum(["resolve", "delete", "add"]).optional().default("resolve").describe("Resolution type. Default is 'resolve'."),
                    reason: z.string().optional().describe("The reason why this resolution is valid."),
                    force: z.boolean().optional().describe("Force resolution, bypassing the safety check."),
                }),
            },
            async ({ id, path: filePath, type, reason, force }) => {
                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();
                    let fileToResolve: string | undefined;
    
                    if (id) {
                        fileToResolve = files.find(f => generateId(f) === id);
                        if (!fileToResolve) {
                            return { content: [{ type: "text", text: "Invalid ID." }], isError: true };
                        }
                    } else if (filePath) {
                        let normalizedPath = filePath;
                        if (path.isAbsolute(filePath)) {
                            normalizedPath = path.relative(projectPath, filePath);
                        }
                        if (files.includes(normalizedPath)) {
                            fileToResolve = normalizedPath;
                        } else {
                            return { content: [{ type: "text", text: `File not found in conflicted files. Searched for: ${normalizedPath}` }], isError: true };
                        }
                    }
    
                    if (!fileToResolve) {
                        return { content: [{ type: "text", text: "Could not determine file to resolve. Please provide id or path." }], isError: true };
                    }
    
                    const absolutePath = path.join(projectPath, fileToResolve);
                    const resolutionType = type || "resolve";
    
                    const result = await addPendingResolve({
                        filePath: fileToResolve,
                        absolutePath,
                        projectPath,
                        type: resolutionType,
                        reason,
                    });
    
                    if (!result.success) {
                        return { content: [{ type: "text", text: `Error: ${result.error}` }], isError: true };
                    }
    
                    // Check for status if returned by addPendingResolve (need to cast until typed)
                    const status = (result as any).status;
                    let msg = `Request sent!\n\nFile: ${fileToResolve}`;
                    if (status === 'draft') {
                        msg += `\n\nWARNING: The resolution reason was too generic. This item has been marked as 'Draft' and will NOT appear in the review list until the reason is updated.`;
                    }
    
                    return {
                        content: [{
                            type: "text",
                            text: msg
                        }]
                    };
    
                } catch (e: any) {
                    return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
                }
            }
        );
    }
  • Invocation of the registerResolveConflict function within the main tools registration module.
    registerResolveConflict(server);
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 of behavioral disclosure. It effectively explains that resolution is performed by a human through WebUI (not automated), which is a key behavioral trait. It mentions different resolution types but doesn't detail what happens after the request (e.g., response format, timing, or error handling). For a tool with no annotations, this is adequate but lacks depth on operational aspects.

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 that each serve a purpose: stating the action, explaining the human/WebUI process, and giving prerequisites. It's front-loaded with the core purpose. There's no wasted text, though it could be slightly more structured (e.g., bullet points for resolution types).

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?

Given no annotations, no output schema, and 5 parameters with full schema coverage, the description is moderately complete. It covers the purpose, human involvement, and prerequisites well, but lacks details on return values, error cases, or what 'post_resolve' entails. For a tool that initiates a human process, more context on expected outcomes or follow-up steps would enhance completeness.

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 all 5 parameters thoroughly. The description adds minimal value beyond the schema: it mentions 'ID or file path' (mapping to 'id' and 'path') and 'different resolution types' (mapping to 'type'), but doesn't provide additional context like parameter interactions or examples. Baseline 3 is appropriate when 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 clearly states the tool's purpose: 'Request conflict resolution by its ID or file path' with the specific action being a request for human resolution through WebUI. It distinguishes from siblings like 'list_conflicts' (which lists) and 'post_resolve' (which follows up), but doesn't explicitly contrast with 'read_conflict'. The verb 'request' is specific and the resource 'conflict resolution' is well-defined.

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 context on when to use: for conflict resolution scenarios like content or delete/modify conflicts. It explicitly states 'You must run post_resolve before running this tool', which is a crucial prerequisite. However, it doesn't specify when NOT to use this tool or mention alternatives among siblings, such as when to use 'read_conflict' instead.

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