# Section & Page Templates

> Browse the template catalog, fetch selected source, and tailor it safely

Canonical URL: https://fa7e86e3d553:3005/tools/templates

The template workflow uses two MCP v3 tools:

- `lexsis_template_library` searches section templates and complete page kits.
- `lexsis_design` action `get_section` fetches full source for one to three
  selected sections.

Search results contain metadata only. Fetch full HTML, CSS, and JavaScript only
after choosing a result.

## Search section templates

```json
{
  "name": "lexsis_template_library",
  "arguments": {
    "action": "search_sections",
    "args": {
      "query": "warm editorial product story",
      "section": "product-info",
      "industry": "home",
      "page_type": "pdp",
      "limit": 8,
      "page": 1
    }
  }
}
```

`query` is optional. Omit it or pass an empty string to browse manually:

```json
{
  "name": "lexsis_template_library",
  "arguments": {
    "action": "search_sections",
    "args": {
      "section": "reviews",
      "mood": "editorial",
      "page": 1,
      "limit": 12
    }
  }
}
```

### Section search arguments

| Argument | Type | Description |
|---|---|---|
| `query` | string | Optional natural-language query; empty means browse |
| `section` | enum | Section-type filter |
| `industry` | enum | Industry filter |
| `mood` | enum | Visual-mood filter |
| `page_type` | enum | PDP, landing, homepage, collection, or another supported page type |
| `islands` | string[] | Filter by required islands; uses the compatibility search path |
| `limit` | number, 1–20 | Results per page; default 5 |
| `page` | positive integer | Catalog page; default 1 |

The response includes `results`, `total`, `page`, `total_pages`, `has_more`,
`source`, and the normalized `request`.

Catalog metadata such as `has_js`, `islands_used`, `themable`, and `size_kb`
is useful for discovery but is not authoritative until the section artifact is
fetched. Use the artifact returned by `get_section` to determine the actual
HTML, CSS, JavaScript, and islands.

## Search page kits

Page kits are ordered groups of section-template slugs that form a coherent
page.

```json
{
  "name": "lexsis_template_library",
  "arguments": {
    "action": "search_page_kits",
    "args": {
      "query": "luxury home product PDP",
      "page_type": "pdp",
      "industry": "home",
      "mood": "editorial",
      "limit": 5,
      "page": 1
    }
  }
}
```

`query` is also optional for page kits. Structured filter-only browsing is the
preferred fallback when semantic search is slow or unavailable.

Additional page-kit arguments include `archetype`, which describes a narrower
narrative or conversion pattern than `page_type`.

Each result contains an ordered `sections` array. Fetch those section slugs in
batches of at most three.

## Fetch full section source

```json
{
  "name": "lexsis_design",
  "arguments": {
    "action": "get_section",
    "args": {
      "ids": [
        "approach-dune-form-notes",
        "https://storefront.trylexsis.com/templates/thesis-reviews-stamped"
      ]
    }
  }
}
```

The `ids` array accepts one to three template slugs or complete public gallery
URLs. A pasted URL is resolved to its final path segment automatically.

Do not pass a `format` argument. The response format is always
`authoring_source`.

```typescript
{
  format: "authoring_source";
  authoring_guidance: string;
  count: number;
  results: Array<{
    id: string;
    name: string;
    description: string;
    section: string;
    mood: string | null;
    tags: string[];
    industries: string[];
    page_types: string[];
    islands_used: string[];
    themable: boolean;
    size_kb: number;
    has_js: boolean;
    source: string | null;
    conversion_issues?: Array<{
      code: string;
      message: string;
    }>;
  }>;
  not_found?: string[];
}
```

## What template source can contain

A fetched template is a complete source-format section. It can contain:

- Plain semantic HTML with Tailwind classes
- One or more `<lx-island>` elements
- A scoped `<style>` block
- A scoped executable `<script>` block
- No islands at all

Do not assume every template is island-based. Preserve useful local
interaction code, replace structural CSS with Tailwind where practical, and
tailor all copy, assets, product references, currency, and brand tokens before
using the section.

Always compile the tailored source before patching or creating a page.

## Complete workflow

```text
1. Browse:
   lexsis_template_library → search_sections or search_page_kits

2. Select:
   Let the user choose in the interactive gallery when the host supports it.

3. Fetch:
   lexsis_design → get_section, maximum three ids per call

4. Tailor:
   Replace copy, images, product data, currency, and theme-specific values.

5. Compile:
   lexsis_pages → compile

6. Apply:
   lexsis_drafts → page_patch/page_update_section
   or lexsis_page_create → create

7. Verify:
   Run integrity checks and responsive browser QA.
```

## Search fallback

If a natural-language query fails or times out:

1. Retry with an empty query and structured filters.
2. Browse by `section`, `page_type`, `industry`, or `mood`.
3. Fetch a known public template URL directly with `get_section`.
4. Report the search failure rather than claiming that the library has no
   matching template.

## Related

- [Page Management](/tools/page-management)
- [Page Source Contract](/pages/schema)
- [Design Intelligence](/tools/design-intelligence)
