# Search Library Tool

`library_search` searches the Library: item names, and documents' text by words and meaning. The most relevant items come first, each with its score.

## When to Use

The agent uses it to find an item it doesn't know the location of. To browse a folder, use `library_list`.

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | What to look for, in words |
| `kind` | string | No | Only items of this kind: `document`, `folder` or `file`. Folders are returned with documents and files unless `kind` narrows the search |
| `media_kind` | string | No | Only files of this media kind: `image`, `pdf`, `file`, `audio` or `video` |
| `unfiled` | boolean | No | `true` searches only the unfiled items (the Other folder) |
| `limit` | integer | No | Most items to return: default 20, at most 50 |

## Returns

| Field | Type | Description |
|-------|------|-------------|
| `items` | array | Hits, most relevant first: each item as `library_get` returns `item`, plus `score` |

## Example Scenario

```json
{ "query": "quarterly revenue forecast", "kind": "document", "limit": 5 }
```

## Notes

- An empty query is refused
- Items the AI access policy does not let AI read are left out
- Risk: read
