Skip to content

Conversation

@bbarker
Copy link
Contributor

@bbarker bbarker commented Jan 9, 2026

Overview

Adds two new MCP tools to expose Unison's reflog and history functionality to AI agents:

  • reflog - Get branch state change history (wraps UCM reflog command)
  • history - Get causal history with diffs (wraps UCM history command)

reflog tool arguments:

{
  "projectContext": { "projectName": "@user/project", "branchName": "main" },
  "scope": "branch" | "project" | "global",  // optional, default "branch"
  "limit": 100   // optional, default 100
}

history tool arguments:

{
  "projectContext": { "projectName": "@user/project", "branchName": "main" },
  "startHash": "#abc123...",  // optional
  "limit": 100,               // optional, uses UCM history default
  "diffLimit": 10             // optional, uses UCM history default
}

Implementation notes

  • reflogTool: Uses Codebase.getProjectBranchReflog, getProjectReflog, and getGlobalReflog - same functions as UCM reflog command. Returns structured JSON.

  • historyTool: Uses handleInputMCP with Input.HistoryI - same handler as UCM history command. Returns UCM-formatted text output.

  • No core file modifications: Only added code to MCP/Types.hs and MCP/Tools.hs.

Test coverage

Tested manually via MCP tool invocations on a local project after restarting the unison mcp server from claude code.

@aryairani
Copy link
Contributor

aryairani commented Jan 15, 2026

Could you add an mcp transcript test to unison-src/transcripts/idempotent/mcp.md? Ping me back if any concerns.

@ChrisPenner ChrisPenner added the ready-to-merge Apply this to a PR and it will get merged automatically once CI passes and 1 reviewer has approved label Jan 22, 2026
@bbarker bbarker force-pushed the mcp_reflog_history branch from 40b7a47 to 6f322d8 Compare January 27, 2026 13:04
@bbarker
Copy link
Contributor Author

bbarker commented Jan 27, 2026

Thanks @ChrisPenner - rebased

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Apply this to a PR and it will get merged automatically once CI passes and 1 reviewer has approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants