{"record":{"id":"fce70b5f0bd2b2ca","repo":"gitbutlerapp/gitbutler","slug":"no-repository-was-provided-and-this-mcp-client-doe","errorCode":null,"errorMessage":"No repository was provided and this MCP client does not expose filesystem roots. Pass the repository argument explicitly.","messagePattern":"No repository was provided and this MCP client does not expose filesystem roots\\. Pass the repository argument explicitly\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/mcp/mod.rs","lineNumber":501,"sourceCode":") -> Result<WorkspaceView> {\n    let resolved = resolve_repository(request.repository, context).await?;\n    workspace_view_from_context(&resolved.ctx, &resolved.repository.path)\n}\n\nasync fn resolve_repository(\n    repository: Option<PathBuf>,\n    context: RequestContext<RoleServer>,\n) -> Result<ResolvedRepository> {\n    if let Some(repository) = repository {\n        return open_repository(&repository);\n    }\n\n    let peer = context.peer;\n    let supports_roots = peer\n        .peer_info()\n        .is_some_and(|client| client.capabilities.roots.is_some());\n    if !supports_roots {\n        bail!(\n            \"No repository was provided and this MCP client does not expose filesystem roots. Pass the repository argument explicitly.\"\n        );\n    }\n\n    let roots = peer\n        .list_roots()\n        .await\n        .context(\"Could not request filesystem roots from the MCP client\")?;\n    repository_from_roots(&roots.roots)\n}\n\nfn repository_from_roots(roots: &[Root]) -> Result<ResolvedRepository> {\n    if roots.is_empty() {\n        bail!(\n            \"The MCP client did not provide any filesystem roots. Pass the repository argument explicitly.\"\n        );\n    }\n","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/mcp/mod.rs#L483-L519","documentation":"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.","triggerScenarios":"Calling any but MCP tool without the `repository` argument from a client whose capability negotiation does not include roots support.","commonSituations":"Older MCP clients predating the roots capability; proxies or gateways that strip client capabilities; minimal custom test clients.","solutions":["Pass the `repository` path argument explicitly in the tool call.","Upgrade the MCP client to a version that implements and advertises filesystem roots.","Verify capability negotiation (peer_info) shows roots support before relying on implicit resolution."],"exampleFix":"// before\n{ \"review_numbers\": [12] }  // no repository, client has no roots\n\n// after\n{ \"repository\": \"/home/user/project\", \"review_numbers\": [12] }","handlingStrategy":"validation","validationCode":"let supports_roots = context.peer\n    .peer_info()\n    .is_some_and(|c| c.capabilities.roots.is_some());\nif repository.is_none() && !supports_roots {\n    anyhow::bail!(\"pass the repository argument explicitly; this client has no roots capability\");\n}","typeGuard":null,"tryCatchPattern":"match resolve_repository(repository, context).await {\n    Err(err) if err.to_string().contains(\"filesystem roots\") => {\n        // retry once with an explicit repository path supplied by the caller\n    }\n    other => other,\n}","preventionTips":["Always pass the `repository` argument from thin or proxied MCP clients.","Advertise the roots capability in custom clients before relying on implicit resolution.","Check peer capabilities during client bring-up, not at first tool failure."],"tags":["mcp","repository","capabilities","roots"],"backgroundTag":"missing-required-argument","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}