nbinlineai.source_tools
search_files
search_files(query: str, path: str = '.', pattern: str = '*', regex: bool = False, limit: int = 20) -> strSearch saved file text with bounded results and file filters.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
str | required | Literal text or regular expression, at most 500 characters. |
path |
str | '.' |
Saved file or directory, relative to kernel cwd or absolute. |
pattern |
str | '*' |
File name glob, at most 200 characters. |
regex |
bool | False |
Interpret query as a regular expression. |
limit |
int | 20 |
Maximum matches, from 1 through 50. |
| returns | str | Bounded matches from saved files, with a partial-results notice when needed. |
search_notebooks
search_notebooks(query: str, path: str = '.', limit: int = 20) -> strSearch saved notebook cell source and show saved cell IDs when present.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
str | required | Literal cell-source text, at most 500 characters. |
path |
str | '.' |
Saved notebook or directory, relative to kernel cwd or absolute. |
limit |
int | 20 |
Maximum matching cells, from 1 through 50. |
| returns | str | Bounded saved-cell matches with IDs and a partial-results notice when needed. |
source_doc
source_doc(path: str, symbol: str = '') -> strRead Python source documentation statically, without importing the file.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | required | Saved .py file, relative to kernel cwd or absolute. |
symbol |
str | '' |
Dotted definition name of at most 200 characters, or empty for module. |
| returns | str | Bounded source documentation, declaration header, and public names. |
notebook_outline
notebook_outline(path: str, start: int = 0, limit: int = 20) -> strSummarize a saved notebook’s cells by index, with saved IDs when present.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | required | Saved .ipynb file, relative to kernel cwd or absolute. |
start |
int | 0 |
First zero-based cell index, from 0 through 100000. |
limit |
int | 20 |
Maximum cells to list, from 1 through 50. |
| returns | str | Bounded indexed cells, IDs, and source previews from the saved file. |
document_outline
document_outline(path: str, start: int = 0, limit: int = 20) -> strList a saved document’s heading or code sections with addresses.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | required | Saved Markdown or Python file, relative to kernel cwd or absolute. |
start |
int | 0 |
First zero-based outline row, from 0 through 100000. |
limit |
int | 20 |
Maximum rows to list, from 1 through 50. |
| returns | str | Bounded outline rows with source-bound section addresses. |
read_document_section
read_document_section(path: str, section: str = '') -> strRead a saved document section by an address from document_outline.
An address becomes stale when the source file changes. Refresh the outline to get a new address.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | required | Saved Markdown or Python file, relative to kernel cwd or absolute. |
section |
str | '' |
Outline address of at most 200 characters, or empty for all. |
| returns | str | Bounded saved source from the verified section address. |
file_strs_replace
file_strs_replace(path: str, old_strings: list[str], new_strings: list[str]) -> strReplace several exact literals atomically when each old string occurs once.
Each old and new string can contain at most 8000 characters. Old strings must not overlap in the saved text.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | required | Existing saved text file, relative to kernel cwd or absolute. |
old_strings |
list[str] | required | One through 20 distinct, nonempty literals occurring once each. |
new_strings |
list[str] | required | One replacement per old literal; each at most 8000 characters. |
| returns | str | Bounded change report and diff for an atomic saved-file edit. |
view_file_hashes
view_file_hashes(path: str, start_line: int = 1, end_line: int = 40) -> strShow numbered lines and the SHA-256 digest for a saved text file.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | required | Saved text file, relative to kernel cwd or absolute. |
start_line |
int | 1 |
First one-based line, from 1 through 1000000. |
end_line |
int | 40 |
Inclusive last line; at most 80 lines per request. |
| returns | str | Bounded numbered saved lines and the whole-file SHA-256 digest. |
file_replace_checked
file_replace_checked(path: str, old_str: str, new_str: str, expected_sha256: str) -> strReplace one literal only when the whole file has the expected SHA-256.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | required | Existing saved text file, relative to kernel cwd or absolute. |
old_str |
str | required | Nonempty literal to replace exactly once; at most 8000 characters. |
new_str |
str | required | Replacement text, at most 8000 characters. |
expected_sha256 |
str | required | Whole-file 64-digit hex digest from view_file_hashes. |
| returns | str | Bounded change report and diff after hash and match checks. |