gitbutlerapp/gitbutler · error

No repository was provided and this MCP client does not expo

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's resolve_repository (crates/but/src/command/mcp/mod.rs:501) needs a repository either from the explicit `repository` argument or from the client's filesystem-roots capability. If the client does not advertise roots (peer_info().capabilities.roots is None), there is no way to infer one, so it bails asking for the explicit argument.

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 caf1f223d3)

Solutions

  1. Pass the `repository` path argument explicitly in the tool call.
  2. Upgrade the MCP client to a version that implements and advertises filesystem roots.
  3. Verify capability negotiation (peer_info) shows roots support before relying on implicit resolution.

Example fix

// before
{ "review_numbers": [12] }  // no repository, client has no roots

// after
{ "repository": "/home/user/project", "review_numbers": [12] }
Defensive patterns

Strategy: validation

Validate before calling

let supports_roots = context.peer
    .peer_info()
    .is_some_and(|c| c.capabilities.roots.is_some());
if repository.is_none() && !supports_roots {
    anyhow::bail!("pass the repository argument explicitly; this client has no roots capability");
}

Try / catch

match resolve_repository(repository, context).await {
    Err(err) if err.to_string().contains("filesystem roots") => {
        // retry once with an explicit repository path supplied by the caller
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling any but MCP tool without the `repository` argument from a client whose capability negotiation does not include roots support.

Common situations: Older MCP clients predating the roots capability; proxies or gateways that strip client capabilities; minimal custom test clients.

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@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/fce70b5f0bd2b2ca. Report an issue: GitHub.