Skip to content

Commit 21df630

Browse files
authored
fix(acp): use file_path parameter for mcpls tool calls (#1539)
* fix(acp): use file_path parameter for mcpls tool calls McpLspProvider was sending "uri" as the parameter key for all mcpls tool invocations, but mcpls 0.3.4 expects "file_path". Fixes all six affected methods: hover, definition, references, diagnostics, document_symbols, and code_actions. Also fix code_actions to send flat start_line/start_character/end_line/ end_character instead of a nested range object, matching the mcpls get_code_actions tool schema. Closes #1533 * docs(changelog): add entry for #1533 acp lsp param fix
1 parent 045181e commit 21df630

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
88

99
### Fixed
1010

11+
- `McpLspProvider` was sending `"uri"` as the parameter key to all mcpls tool calls, but mcpls 0.3.4 expects `"file_path"`. All six methods (`hover`, `definition`, `references`, `diagnostics`, `document_symbols`, `code_actions`) are fixed. `code_actions` additionally now sends flat `start_line`/`start_character`/`end_line`/`end_character` fields instead of a nested `range` object, matching the mcpls `get_code_actions` schema. Fixes #1533.
1112
- `--init` wizard generated unsupported `--workspace-root` flag for mcpls. The wizard now writes `.zeph/mcpls.toml` (with workspace roots, language extensions, and rust-analyzer LSP server config) and passes `--config .zeph/mcpls.toml` to mcpls instead. Fixes broken LSP setup for all users who configured mcpls via `zeph init`. (#1534)
1213
- Shell command blocklist (`blocked_commands`, `DEFAULT_BLOCKED`, `allow_network = false`) was silently skipped whenever a `PermissionPolicy` was attached to `ShellExecutor` (i.e., in all normal operation with `autonomy_level` set). `find_blocked_command()` now runs unconditionally before the policy check, making it a hard security boundary that cannot be bypassed by any autonomy level or permission policy configuration.
1314

crates/zeph-acp/src/lsp/mcp_provider.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl LspProvider for McpLspProvider {
107107
line: u32,
108108
character: u32,
109109
) -> Result<LspHoverResult, AcpError> {
110-
let args = serde_json::json!({ "uri": uri, "line": line, "character": character });
110+
let args = serde_json::json!({ "file_path": uri, "line": line, "character": character });
111111
self.call_tool("get_hover", args).await.and_then(|v| {
112112
serde_json::from_value(v).map_err(|e| AcpError::ClientError(e.to_string()))
113113
})
@@ -119,7 +119,7 @@ impl LspProvider for McpLspProvider {
119119
line: u32,
120120
character: u32,
121121
) -> Result<Vec<LspLocation>, AcpError> {
122-
let args = serde_json::json!({ "uri": uri, "line": line, "character": character });
122+
let args = serde_json::json!({ "file_path": uri, "line": line, "character": character });
123123
self.call_tool("get_definition", args).await.and_then(|v| {
124124
serde_json::from_value(v).map_err(|e| AcpError::ClientError(e.to_string()))
125125
})
@@ -133,7 +133,7 @@ impl LspProvider for McpLspProvider {
133133
include_declaration: bool,
134134
) -> Result<Vec<LspLocation>, AcpError> {
135135
let args = serde_json::json!({
136-
"uri": uri,
136+
"file_path": uri,
137137
"line": line,
138138
"character": character,
139139
"include_declaration": include_declaration,
@@ -147,14 +147,14 @@ impl LspProvider for McpLspProvider {
147147
}
148148

149149
async fn diagnostics(&self, uri: &str) -> Result<Vec<LspDiagnostic>, AcpError> {
150-
let args = serde_json::json!({ "uri": uri });
150+
let args = serde_json::json!({ "file_path": uri });
151151
self.call_tool("get_diagnostics", args).await.and_then(|v| {
152152
serde_json::from_value(v).map_err(|e| AcpError::ClientError(e.to_string()))
153153
})
154154
}
155155

156156
async fn document_symbols(&self, uri: &str) -> Result<Vec<LspDocumentSymbol>, AcpError> {
157-
let args = serde_json::json!({ "uri": uri });
157+
let args = serde_json::json!({ "file_path": uri });
158158
self.call_tool("get_document_symbols", args)
159159
.await
160160
.and_then(|v| {
@@ -178,12 +178,14 @@ impl LspProvider for McpLspProvider {
178178
&self,
179179
uri: &str,
180180
range: &LspRange,
181-
diagnostics: &[LspDiagnostic],
181+
_diagnostics: &[LspDiagnostic],
182182
) -> Result<Vec<LspCodeAction>, AcpError> {
183183
let args = serde_json::json!({
184-
"uri": uri,
185-
"range": range,
186-
"diagnostics": diagnostics,
184+
"file_path": uri,
185+
"start_line": range.start.line,
186+
"start_character": range.start.character,
187+
"end_line": range.end.line,
188+
"end_character": range.end.character,
187189
});
188190
let value = self.call_tool("get_code_actions", args).await?;
189191
let actions: Vec<LspCodeAction> =

0 commit comments

Comments
 (0)