> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memcontext.in/llms.txt
> Use this file to discover all available pages before exploring further.

# search_memory

> Retrieve relevant memories for the assistant's current task.

## Description

`search_memory` finds memories that may help the assistant answer, code, plan, or
make a decision. Use full natural-language questions for best results.

## Parameters

| Parameter   | Type   | Required | Default | Description                                                                        |
| ----------- | ------ | -------- | ------- | ---------------------------------------------------------------------------------- |
| `query`     | string | Yes      | -       | Natural language description of what to find. Full sentences produce best results. |
| `limit`     | number | No       | 5       | Number of results to return. Use higher values for broad topics.                   |
| `category`  | string | No       | all     | Filter to `preference`, `fact`, `decision`, or `context`.                          |
| `project`   | string | No       | all     | Filter to a specific known project.                                                |
| `threshold` | number | No       | 0.6     | Search strictness. Higher values return broader matches.                           |

## Example

```
search_memory({
  query: "What package manager does the user prefer?",
  project: "memcontext"
})
```

## Response

```json theme={null}
{
  "found": 1,
  "memories": [
    {
      "id": "a1b2c3d4-...",
      "content": "User prefers pnpm for JavaScript projects.",
      "category": "preference",
      "relevance": 0.92,
      "createdAt": "2026-04-11T12:00:00.000Z"
    }
  ]
}
```

Each result includes a `relevance` score from 0 to 1.

## Query Guidelines

* Ask a complete question.
* Include the project name when it matters.
* Use `category` if you only need one type of memory.
* Increase `limit` when preparing a larger answer.

Good:

```text theme={null}
What package manager does the user prefer?
```

Less effective:

```text theme={null}
package manager
```

<Note>
  MCP tools intentionally do not expose `scope`. Use the REST API or TypeScript
  SDK when your app needs per-user or per-tenant isolation.
</Note>
