# Sets Guide

A **Set** is a curated collection of specific Binding Versions — like a playlist for knowledge.

## Why Sets?

Sets let you:
- Group related knowledge for a specific context or project
- Pin specific Versions (not just "latest") for stability
- Retrieve all content at once with a token budget via `mcp_get_set_context`

## How Sets Work

A Set contains references to specific **Versions**, not Bindings. This means:
- When a Binding is updated, the Set still points to the Version you added
- You control exactly which Version of each Binding is in the Set
- To update, remove the old Version and add the new one

```
Set: "Deployment Reference"
├── Position 1: Kubernetes Guide v3
├── Position 2: Docker Best Practices v1
└── Position 3: CI/CD Pipeline Notes v2
```

## Token Budget Retrieval

The most powerful Set feature is `mcp_get_set_context`:

```
mcp_get_set_context({
  setId: "set-id",
  maxTokens: 8000,
  tier: "1.5"
})
```

This assembles all Versions in the Set within your token budget. If the total exceeds the budget, content is truncated and `truncated: true` is returned.

## Creating and Managing Sets

### Create a Set
```
mcp_create_set({
  spaceId: "space-id",
  name: "My Collection",
  description: "Related resources for project X"
})
```

### Add Versions
```
mcp_add_version_to_set({
  setId: "set-id",
  versionId: "version-id",
  position: 1
})
```

### Remove Versions
```
mcp_remove_version_from_set({
  setId: "set-id",
  versionId: "version-id"
})
```

## Set Metadata

Each Set tracks:
- **versionCount**: Number of Versions included
- **totalTokenCount**: Sum of all Version token counts (for budget planning)
