# JendHub > JendHub is a search engine for the definitions of Base (the standard library of Bend) and of the packages on BendHub (https://hub.bend-lang.com). Before you write a Bend function or type, use `search` to find one that exists. Tell what you need in a few words: the task, some keywords or a short description, for example `decompress gzip data`, `base64 encode` or `sha256 hash of bytes`. Each result gives the `definition` call that opens its code. Use `read` to see more of a file, `grep` to find code in one release, and `files` to list the files of a release. A path names a release as `name@version` and then a file in it, for example `kit@1.0.0.0/json.bend`. Base is `Base/base.bend`. Use a result only when it does exactly what you need. Write its import line at the top of your Bend file, and call it by the name that the result gives: after `import kit@1.0.0.0/json.bend as Json`, call `Json.parse(text)`. Base needs only `import Base`. When a result is close to what you need, copy its code and the import lines that `definition` gives into your project, and change it. You can read and copy all code on BendHub. ## Tools Each tool is a `GET` path that takes its parameters in the query string. Encode each value for a URL: for example, `+` is `%2B`, `#` is `%23`, `&` is `%26` and a space is `%20`. Each tool answers with plain text, also for an error. In an answer, a call to a tool is a full URL that you can `GET`. ### search `GET https://jend.leeeet.dev/search.txt?query=&package=&uses=&used_by=&limit=10&offset=0` Find the definitions (functions, types and laws) of Base and of the BendHub packages. The best results come first. Each result gives the name to call, the import line, the head (doc comment and signature), and the `definition` call that opens its code. Parameters: - `query` (string, at most 1000 characters, optional): What you need in a few words. Without it, the results are the definitions that the filters give, the most used first. - `package` (list of strings, at most 10 values, optional): Search only the definitions of this package, for example `bend-kit-json`. Base is `Base`. - `uses` (list of strings, at most 10 values, optional): Search only the definitions that use this definition. Name it as `package/module:name`, for example `bend-kit-json/json:parse.bytes`. A definition of Base is its name, for example `List.map`. Give it more than once to keep only the definitions that match each value. - `used_by` (list of strings, at most 10 values, optional): Search only the definitions that this definition uses. Name it as `package/module:name`, for example `bend-kit-json/json:parse.bytes`. A definition of Base is its name, for example `List.map`. Give it more than once to keep only the definitions that match each value. - `limit` (integer, 1 to 50, default 10): The number of results to give. - `offset` (integer, 0 to 49, default 0): The number of best results to skip, to get the next page. ### definition `GET https://jend.leeeet.dev/definition.txt?path=&name=` Open one definition. The answer gives its code, the import lines that the code needs, and the definitions that the code uses, each with the `definition` call that opens it. Each import line names an exact release, so you can copy the code and its import lines into your project. The answer also gives the `read` call for the lines of the definition in its file. `definition` opens only the definitions of Base and of the latest valid release of each package, because only they are in the index. `read`, `grep` and `files` work on every release. Parameters: - `path` (string, required): The file, as its import line names it, for example `kit@1.0.0.0/json.bend`. Base is `Base/base.bend`. - `name` (string, required): The name of the definition as its file declares it, for example `parse` or `List.map`. Give it with no alias of an import line: `parse`, not `Json.parse`. ### read `GET https://jend.leeeet.dev/read.txt?path=&start_line=1&end_line=` Read lines of a file of Base or of a release on BendHub. The answer gives each line as its number, a tab and its text, and cuts a line after 2000 characters. If the answer stops before `end_line`, or before the end of the file when you give no `end_line`, its last line gives the `read` call for the next lines. The file shows its imports as BendHub stores them: `./` and `../` name files of the same release. To copy code, take its import lines from `definition`. Parameters: - `path` (string, required): The file, as its import line names it, for example `kit@1.0.0.0/json.bend`. Base is `Base/base.bend`. - `start_line` (integer, at least 1, default 1): The number of the first line to give. Line numbers start at 1. - `end_line` (integer, at least 1, optional): The number of the last line to give. Without it, the answer goes to the end of the file. An answer gives at most 2000 lines. ### grep `GET https://jend.leeeet.dev/grep.txt?pattern=&path=&glob=&mode=lines&context=&before=&after=&ignore_case=false&multiline=false&limit=250&offset=0` Find the lines of one release that match a regular expression, with ripgrep. In mode `lines`, a matching line comes as `path:line:text` and a context line as `path-line-text`, with the path and the line number that `read` takes. A line `--` separates groups of lines that are not next to each other. Mode `files` gives one path on each line, and mode `counts` gives `path:count`. If more results exist, the last line of the answer gives the `grep` call for the next page. Parameters: - `pattern` (string, required): A regular expression in ripgrep syntax, for example `def parse` or `type \w+ is Data`. Escape a literal brace: `Box\{value`. - `path` (string, required): One release, or a directory or a file in it, for example `kit@1.0.0.0` or `kit@1.0.0.0/src`. Base is `Base`. - `glob` (string, optional): Search only the files that match this glob. A glob with a `/` matches the path of a file from the top of its release, for example `src/**`. A glob with no `/` matches the name of a file in any directory, for example `*.bend`. A glob that starts with `!` leaves out the files that match it. - `mode` ("lines" | "files" | "counts", default "lines"): `lines` gives the matching lines, `files` gives the paths of the files that match, and `counts` gives the number of matching lines in each file. - `context` (integer, at least 0, optional): The number of lines to show before and after each match. Only for mode `lines`. - `before` (integer, at least 0, optional): The number of lines to show before each match. Only for mode `lines`. - `after` (integer, at least 0, optional): The number of lines to show after each match. Only for mode `lines`. - `ignore_case` (boolean, default false): Match upper case and lower case letters as the same. - `multiline` (boolean, default false): Let a match go across lines. Then `.` also matches a line end. - `limit` (integer, 1 to 1000, default 250): The number of lines to give. Each match, context line, `--`, path or count is one line. - `offset` (integer, at least 0, default 0): The number of lines to skip, to get the next page. ### files `GET https://jend.leeeet.dev/files.txt?path=&glob=&limit=1000&offset=0` List the files of one release, or of a directory in it, with the paths that `read`, `grep` and `definition` take. If more paths exist, the last line of the answer gives the `files` call for the next page. Parameters: - `path` (string, required): One release, or a directory in it, for example `kit@1.0.0.0`. Base is `Base`. - `glob` (string, optional): List only the files that match this glob. A glob with a `/` matches the path of a file from the top of its release, for example `src/**`. A glob with no `/` matches the name of a file in any directory, for example `*.bend`. A glob that starts with `!` leaves out the files that match it. - `limit` (integer, 1 to 1000, default 1000): The number of paths to give. - `offset` (integer, at least 0, default 0): The number of paths to skip, to get the next page.