You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(read_file): improve tool descriptions following Anthropic guidelines
- Add explicit 'when to use' guidance for slice and indentation modes
- Add indentation mode example alongside existing slice example
- Fix confusing 'indentation.anchor_line' text in mode description
- Add 'when NOT to use' guidance in anchor_line description
- Enhance descriptions to help non-OpenAI models choose appropriate mode
This follows Anthropic's documented best practices for tool descriptions:
- Explain what the tool does
- Specify when to use and when NOT to use
- Describe parameter impact
- Aim for 3-4+ sentences
"Read a file and return its contents with line numbers for diffing or discussion. IMPORTANT: This tool reads exactly one file per call. If you need multiple files, issue multiple parallel read_file calls."
66
66
67
-
constmodeDescription=` Supports two modes: 'slice' (default) reads lines sequentially with offset/limit; 'indentation' extracts semantic code blocks around an anchor line based on indentation hierarchy.`
67
+
constmodeDescription=
68
+
` Supports two modes: 'slice' (default) reads lines sequentially with offset/limit; 'indentation' extracts semantic code blocks around an anchor line based on indentation hierarchy.`+
69
+
` Use slice mode when exploring a file from the beginning, reading configuration files, or when you don't have a specific line number to target.`+
70
+
` Use indentation mode when you have a specific line number from search results, error messages, or definition lookups and want the full containing function/class without truncation.`
68
71
69
72
constlimitNote=` By default, returns up to ${DEFAULT_LINE_LIMIT} lines per file. Lines longer than ${MAX_LINE_LENGTH} characters are truncated.`
"1-based line number to anchor indentation extraction (indentation mode). The block containing this line will be extracted with its context.",
87
+
"1-based line number to anchor the extraction (required for indentation mode). The complete containing function, method, or class will be extracted with proper context. Typically obtained from search results, error stack traces, or definition lookups. If you don't have a specific line number, use slice mode instead.",
"Reading mode. 'slice' (default): read lines sequentially with offset/limit. 'indentation': extract semantic code block around indentation.anchor_line based on indentation.",
119
+
"Reading mode. 'slice' (default): read lines sequentially with offset/limit - use for general file exploration or when you don't have a target line number. 'indentation': extract complete semantic code blocks containing anchor_line - use when you have a line number and want the full function/class without truncation.",
0 commit comments