{"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":"exception","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/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/mcp/mod.rs#L483-L519","documentation":"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.","triggerScenarios":"Calling any repository-scoped MCP tool without the `repository` argument from an MCP client whose InitializeResult capabilities do not include `roots`.","commonSituations":"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.","solutions":["Pass the `repository` argument explicitly in the tool request","Use an MCP client that supports filesystem roots and declares the roots capability","Upgrade the MCP client so it advertises roots capability"],"exampleFix":"// before\n{\"name\": \"review_view\", \"arguments\": {}}\n// after\n{\"name\": \"review_view\", \"arguments\": {\"repository\": \"/path/to/repo\"}}","handlingStrategy":"validation","validationCode":"const args = repo ? { repository: repo } : clientSupportsRoots() ? {} : (() => { throw new Error('repository argument required'); })();","typeGuard":"const hasRepo = (a: {repository?: string}) => typeof a.repository === 'string' && a.repository.length > 0;","tryCatchPattern":"try { await callTool('review_view', args); } catch (e) { if (/does not expose filesystem roots/.test(e.message)) args.repository = promptForRepo(); }","preventionTips":["Always pass `repository` explicitly when embedding the MCP server in scripts","Check client capabilities.roots before omitting the argument","Pin to MCP clients known to declare roots support"],"tags":["mcp","configuration","arguments"],"backgroundTag":"missing-required-argument","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}