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

# context

> Create and update context items (notes, links, saved queries).

Call path: `mgmt.context` after `new ModusManagement(...)`.

## Properties

<ResponseField name={"customItems"} type={"CustomContextItemsResource"} required />

<ResponseField name={"items"} type={"ManagementContextItemsResource"} required />

## Methods

### createLink()

```typescript
createLink(url: string, options?: { title: string; isCrawl: boolean; pageLimit: number }): Promise<CreatedContextItem>
```

Add a URL to the knowledge base.

#### Parameters

<ResponseField name={"url"} type={"string"} required>
  Link URL.
</ResponseField>

<ResponseField name={"options"} type={"{ title: string; isCrawl: boolean; pageLimit: number }"} />

#### Returns

`Promise<CreatedContextItem>`

The created context item.

### createNote()

```typescript
createNote(title: string, content: string): Promise<CreatedContextItem>
```

Add a free-form text note to the knowledge base.

```ts
const note = await mgmt.context.createNote('Runbook', '# Steps\n1. Check logs')
```

#### Parameters

<ResponseField name={"title"} type={"string"} required>
  Note title.
</ResponseField>

<ResponseField name={"content"} type={"string"} required>
  Note body (markdown).
</ResponseField>

#### Returns

`Promise<CreatedContextItem>`

The created context item.

### createSavedQuery()

```typescript
createSavedQuery(name: string, options: { query: string; connectionId: string; description: string; path: string[] }): Promise<CreatedContextItem>
```

Save a SQL query to the knowledge base.

#### Parameters

<ResponseField name={"name"} type={"string"} required>
  Display name for the query.
</ResponseField>

<ResponseField name={"options"} type={"{ query: string; connectionId: string; description: string; path: string[] }"} required />

#### Returns

`Promise<CreatedContextItem>`

The created context item.

### updateLink()

```typescript
updateLink(uid: string, options: { title: string; url: string; existing: object; description: string; userFeedback: UserFeedback; topics: string[] }): Promise<object>
```

Update link metadata on an existing item.

Merges `title` and/or `url` into the stored content blob. Does not re-fetch or re-crawl the URL.

#### Parameters

<ResponseField name={"uid"} type={"string"} required>
  Context item uid.
</ResponseField>

<ResponseField name={"options"} type={"{ title: string; url: string; existing: object; description: string; userFeedba…"} required />

#### Returns

`Promise<object>`

The updated context item.

### updateNote()

```typescript
updateNote(uid: string, options: { title: string; body: string; existing: object; description: string; userFeedback: UserFeedback; topics: string[] }): Promise<object>
```

Update a note's title and markdown body.

Preserves server-owned fields on the existing content blob. Pass `existing`
to skip a fetch when you already have the item from a list call.

#### Parameters

<ResponseField name={"uid"} type={"string"} required>
  Context item uid.
</ResponseField>

<ResponseField name={"options"} type={"{ title: string; body: string; existing: object; description: string; userFeedb…"} required />

#### Returns

`Promise<object>`

The updated context item.

### updateSavedQuery()

```typescript
updateSavedQuery(uid: string, options: { name: string; query: string; connectionId: string; path: string[]; existing: object; description: string; userFeedback: UserFeedback; topics: string[] }): Promise<object>
```

Update a saved query's name, SQL, and optional connection metadata.

#### Parameters

<ResponseField name={"uid"} type={"string"} required>
  Context item uid.
</ResponseField>

<ResponseField name={"options"} type={"{ name: string; query: string; connectionId: string; path: string[]; existing: …"} required />

#### Returns

`Promise<object>`

The updated context item.
