mirror of
https://github.com/instructkr/claw-code.git
synced 2026-12-02 00:00:34 +08:00
fix(tools): expose selector parameter in read_file schema and description (#3395)
This commit is contained in:
1 parent
dae4337e8b
commit
56c53efa64
1 file changed
+16
-2
@@ -506,13 +506,14 @@ pub fn mvp_tool_specs() -> Vec<ToolSpec> {
|
||||
},
|
||||
ToolSpec {
|
||||
name: "read_file",
|
||||
description: "Read a text file from the workspace.",
|
||||
description: "Read a text file from the workspace. Optional `selector` (1-indexed lines; overrides `offset`/`limit`): `50` single line, `50-200` inclusive range, `50+150` start plus count, `5-16,960-973` comma-separated (returned as one block from the first to the last selected line), `raw` for the full file, or `conflicts` for a summary of unresolved git merge conflicts. Without `selector`, `offset` (0-based) and `limit` pick the lines; with neither, the whole file is read.",
|
||||
input_schema: json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": { "type": "string" },
|
||||
"offset": { "type": "integer", "minimum": 0 },
|
||||
"limit": { "type": "integer", "minimum": 1 }
|
||||
"limit": { "type": "integer", "minimum": 1 },
|
||||
"selector": { "type": "string" }
|
||||
},
|
||||
"required": ["path"],
|
||||
"additionalProperties": false
|
||||
@@ -7210,6 +7211,19 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_file_schema_exposes_selector() {
|
||||
let spec = mvp_tool_specs()
|
||||
.into_iter()
|
||||
.find(|spec| spec.name == "read_file")
|
||||
.expect("read_file spec");
|
||||
assert_eq!(
|
||||
spec.input_schema["properties"]["selector"],
|
||||
json!({ "type": "string" })
|
||||
);
|
||||
assert!(spec.description.contains("selector"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn git_show_supports_patch_stat_metadata_and_rejects_metadata_path() {
|
||||
let _guard = env_guard();
|
||||
|
||||
Reference in new issue
Block a user