gitbutlerapp/gitbutler · error

No repository was provided and this MCP client does not…

Error message

No repository was provided and this MCP client does not expose filesystem roots. Pass the repository argument explicitly.

What it means

The MCP server resolves which repository to operate on either from an explicit `repository` argument or from the MCP client's filesystem roots capability. If no repository argument was supplied and the client does not declare roots capability, resolution is impossible, so the request is rejected with guidance to pass the repository explicitly.

Solutions

  1. Pass the `repository` argument explicitly in the tool request
  2. Use an MCP client that supports filesystem roots and declares the roots capability
  3. Upgrade the MCP client so it advertises roots capability

Example fix

// before
{"name": "review_view", "arguments": {}}
// after
{"name": "review_view", "arguments": {"repository": "/path/to/repo"}}
Defensive patterns

Strategy: validation

Validate before calling

const args = repo ? { repository: repo } : clientSupportsRoots() ? {} : (() => { throw new Error('repository argument required'); })();

Type guard

const hasRepo = (a: {repository?: string}) => typeof a.repository === 'string' && a.repository.length > 0;

Try / catch

try { await callTool('review_view', args); } catch (e) { if (/does not expose filesystem roots/.test(e.message)) args.repository = promptForRepo(); }

Prevention

When it happens

Trigger: Calling any repository-scoped MCP tool without the `repository` argument from an MCP client whose InitializeResult capabilities do not include `roots`.

Common situations: Using MCP clients (e.g. simple or older harnesses) that never advertise roots support; scripting tool calls without the repository parameter; misconfigured client not sending capability flags.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/fce70b5f0bd2b2ca. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/command/mcp/mod.rs:501

) -> Result<WorkspaceView> {
    let resolved = resolve_repository(request.repository, context).await?;
    workspace_view_from_context(&resolved.ctx, &resolved.repository.path)
}

async fn resolve_repository(
    repository: Option<PathBuf>,
    context: RequestContext<RoleServer>,
) -> Result<ResolvedRepository> {
    if let Some(repository) = repository {
        return open_repository(&repository);
    }

    let peer = context.peer;
    let supports_roots = peer
        .peer_info()
        .is_some_and(|client| client.capabilities.roots.is_some());
    if !supports_roots {
        bail!(
            "No repository was provided and this MCP client does not expose filesystem roots. Pass the repository argument explicitly."
        );
    }

    let roots = peer
        .list_roots()
        .await
        .context("Could not request filesystem roots from the MCP client")?;
    repository_from_roots(&roots.roots)
}

fn repository_from_roots(roots: &[Root]) -> Result<ResolvedRepository> {
    if roots.is_empty() {
        bail!(
            "The MCP client did not provide any filesystem roots. Pass the repository argument explicitly."
        );
    }

View on GitHub (pinned to 58e5313667)