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

# Tool Filtering

> Load only the MCP tools your use case needs using ALANA_MCP_GROUPS and ALANA_MCP_TOOLS.

## Why Filter Tools?

Every active MCP tool consumes context in your agent's conversation window. Loading all 22 tools when your agent only needs catalog search wastes tokens and can confuse the model with irrelevant options.

Tool filtering lets you load only the tools relevant to your use case — reducing context size and improving focus.

## Environment Variables

### ALANA\_MCP\_GROUPS

Load an entire category of tools by group name:

```bash theme={null}
ALANA_MCP_GROUPS=catalog,search
```

Multiple groups are comma-separated. Available groups:

| Group          | Tools Included                                                              |
| -------------- | --------------------------------------------------------------------------- |
| `catalog`      | `search_products`, `get_product`, `list_catalogs`, `get_catalog_stats`      |
| `optimization` | `optimize_product`, `batch_optimize`, `get_score`, `compare_scores`         |
| `media`        | `generate_description`, `enhance_images`, `get_brand_context`               |
| `analytics`    | `get_search_analytics`, `get_query_performance`, `get_recommendation_stats` |
| `feed`         | Feed generation and status tools                                            |
| `search`       | Advanced search and recommendation tools                                    |

### ALANA\_MCP\_TOOLS

Load specific tools by exact name:

```bash theme={null}
ALANA_MCP_TOOLS=search_products,get_product,optimize_product
```

If both `ALANA_MCP_GROUPS` and `ALANA_MCP_TOOLS` are set, the union of both sets is loaded.

## Configuration Examples

### Catalog agent (read-only search)

```bash theme={null}
ALANA_MCP_GROUPS=catalog
```

Loads 4 tools: `search_products`, `get_product`, `list_catalogs`, `get_catalog_stats`.

### Content optimization agent

```bash theme={null}
ALANA_MCP_GROUPS=catalog,optimization,media
```

Loads 11 tools covering discovery, optimization, and content generation.

### Analytics-only agent

```bash theme={null}
ALANA_MCP_GROUPS=analytics
```

Loads 3 tools — minimal context footprint for reporting workflows.

### Single-tool agent

```bash theme={null}
ALANA_MCP_TOOLS=search_products
```

Loads exactly 1 tool — maximum focus for a search-specific integration.

## Applying to MCP Client Config

### Claude Desktop

```json theme={null}
{
  "mcpServers": {
    "alana-catalog": {
      "url": "https://app.alana.shopping/api/mcp/sse",
      "headers": {
        "Authorization": "Bearer sk_live_your_api_key",
        "X-MCP-Groups": "catalog,search"
      }
    }
  }
}
```

### Environment variable in server config

```json theme={null}
{
  "mcpServers": {
    "alana": {
      "url": "https://app.alana.shopping/api/mcp/sse",
      "headers": {
        "Authorization": "Bearer ${ALANA_API_KEY}"
      },
      "env": {
        "ALANA_MCP_GROUPS": "catalog,optimization"
      }
    }
  }
}
```

## Context Window Impact

| Configuration        | Tools Loaded | Approx. Token Cost |
| -------------------- | ------------ | ------------------ |
| All tools (default)  | 22           | \~4,200 tokens     |
| `catalog` group only | 4            | \~760 tokens       |
| Single tool          | 1            | \~190 tokens       |

Filtering to the tools you need can save 3,000+ tokens per conversation — significant for long agent sessions.
