> ## 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.

# Commerce Tools

> AI-powered content optimization — optimize_product, batch_optimize, get_score, compare_scores.

## optimize\_product

Generate AI-optimized title, description, and attributes for a product.

**Parameters:**

| Parameter         | Type    | Required | Description                                |
| ----------------- | ------- | -------- | ------------------------------------------ |
| `product_id`      | string  | Yes      | Product ID or SKU                          |
| `target_platform` | string  | No       | `google`, `meta`, `openai` (default: all)  |
| `apply`           | boolean | No       | Apply changes immediately (default: false) |

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://app.alana.shopping/api/mcp/sse" \
    -H "Authorization: Bearer sk_live_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"method":"tools/call","params":{"name":"optimize_product","arguments":{"product_id":"SKU-001","target_platform":"google"}}}'
  ```

  ```javascript JavaScript theme={null}
  const result = await client.callTool({
    name: "optimize_product",
    arguments: {
      product_id: "SKU-001",
      target_platform: "google",
      apply: false, // preview only
    },
  });
  console.log(result.content[0].text); // Optimized title + description
  ```

  ```python Python theme={null}
  result = await session.call_tool(
      "optimize_product",
      arguments={
          "product_id": "SKU-001",
          "target_platform": "google",
          "apply": False,
      },
  )
  print(result.content[0].text)
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "product_id": "SKU-001",
  "original": {
    "title": "Blue Shirt",
    "description": "A shirt"
  },
  "optimized": {
    "title": "Men's Blue Cotton Slim-Fit T-Shirt | S-XXL",
    "description": "100% pre-shrunk cotton. Breathable fabric for all-day comfort..."
  },
  "score_before": 0.42,
  "score_after": 0.89,
  "applied": false
}
```

***

## batch\_optimize

Optimize multiple products in a single call.

**Parameters:**

| Parameter         | Type      | Required | Description                                |
| ----------------- | --------- | -------- | ------------------------------------------ |
| `product_ids`     | string\[] | Yes      | Array of product IDs (max: 50)             |
| `target_platform` | string    | No       | Target platform                            |
| `apply`           | boolean   | No       | Apply changes immediately (default: false) |

<CodeGroup>
  ```javascript JavaScript theme={null}
  const result = await client.callTool({
    name: "batch_optimize",
    arguments: {
      product_ids: ["SKU-001", "SKU-002", "SKU-003"],
      target_platform: "google",
      apply: true,
    },
  });
  ```

  ```python Python theme={null}
  result = await session.call_tool(
      "batch_optimize",
      arguments={
          "product_ids": ["SKU-001", "SKU-002", "SKU-003"],
          "target_platform": "google",
          "apply": True,
      },
  )
  ```
</CodeGroup>

***

## get\_score

Get the current optimization score for a product.

**Parameters:**

| Parameter    | Type   | Required | Description       |
| ------------ | ------ | -------- | ----------------- |
| `product_id` | string | Yes      | Product ID or SKU |

**Score ranges:** Excellent (0.85–1.0) · Good (0.65–0.84) · Warning (0.40–0.64) · Poor (0–0.39)

<CodeGroup>
  ```javascript JavaScript theme={null}
  const result = await client.callTool({
    name: "get_score",
    arguments: { product_id: "SKU-001" },
  });
  ```

  ```python Python theme={null}
  result = await session.call_tool(
      "get_score",
      arguments={"product_id": "SKU-001"},
  )
  ```
</CodeGroup>

***

## compare\_scores

Compare optimization scores across a set of products.

**Parameters:**

| Parameter     | Type      | Required | Description                                         |
| ------------- | --------- | -------- | --------------------------------------------------- |
| `product_ids` | string\[] | Yes      | Array of product IDs                                |
| `sort_by`     | string    | No       | `score_asc` or `score_desc` (default: `score_desc`) |

<CodeGroup>
  ```javascript JavaScript theme={null}
  const result = await client.callTool({
    name: "compare_scores",
    arguments: {
      product_ids: ["SKU-001", "SKU-002", "SKU-003"],
      sort_by: "score_asc",
    },
  });
  ```

  ```python Python theme={null}
  result = await session.call_tool(
      "compare_scores",
      arguments={
          "product_ids": ["SKU-001", "SKU-002", "SKU-003"],
          "sort_by": "score_asc",
      },
  )
  ```
</CodeGroup>
