From 9b3ef2779a5a8523c3d9a41abeab6829100aca26 Mon Sep 17 00:00:00 2001 From: DrSkyle <86089508+DrSkyle@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:14:09 +0000 Subject: [PATCH] fix(tools): expose selector parameter in read_file schema and description --- rust/crates/tools/src/lib.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/rust/crates/tools/src/lib.rs b/rust/crates/tools/src/lib.rs index 9a65a685e2..ac052c4931 100644 --- a/rust/crates/tools/src/lib.rs +++ b/rust/crates/tools/src/lib.rs @@ -506,13 +506,14 @@ pub fn mvp_tool_specs() -> Vec { }, 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();