# Session walkthrough

> Step through a complete email build, one tool call at a time: why the host calls it, the arguments it sends, and what comes back.

Source: https://stensul.com/developers/explorer/

Tool names, argument shapes and sequence follow the live server's tool definitions and the server's own email workflow. Arguments and ids are invented. Responses are described from the tool definitions, except check-auth, which was captured from a Stensul-internal tenant on 2026-09-28.

Prompt: "Create a launch email for our Autumn blend in the Northwind Marketing library. Warm, short, one button to northwind.example/autumn. Run the accessibility check when you're done."

## 1. stensul-check-auth

Confirm there's a signed-in session before touching data. On instance-URL connections the host supplies the token, so this passes immediately.

```json
{}
```

```json
{
  "hasToken": true,
  "source": "http-bearer",
  "tenant": "<your-instance>",
  "nextStep": "Authenticated via HTTP bearer. You can call data tools now."
}
```

## 2. stensul-get-libraries

Find the library named in the prompt and learn its rules: modules, enabled settings, length caps, variations mode.

```json
{
  "library_key": "northwind_marketing"
}
```

The library's module inventory, variations mode, `subject_line_enabled: true`, `preheader_enabled: true` with their caps, supported languages and tags. The assistant now knows it may set a subject line and preheader.

## 3. stensul-list-emails

Find an approved template that fits a product launch.

```json
{
  "types": [
    "template"
  ],
  "library_keys": [
    "northwind_marketing"
  ],
  "q": "launch"
}
```

A page of templates. The assistant picks "Product launch" and notes its id.

## 4. stensul-read-email

Read the template's structure and guardrails so content can be placed by position without breaking a rule.

```json
{
  "emailId": "64f0c0ffee0000000000abcd",
  "view": "plan"
}
```

Modules in order (header, opening section, two feature cards, footer), each element's type and position, `guardrailProfiles` (character caps, palette), which elements can be hidden, and a `save_version`. The footer text is locked.

## 5. stensul-build-email

Create the whole draft in one call: copy, button, image with alt text, subject line and preheader.

```json
{
  "name": "Northwind – Autumn blend launch",
  "template_id": "64f0c0ffee0000000000abcd",
  "library_key": "northwind_marketing",
  "subject_line": "The Autumn blend is here",
  "preheader": "Small-batch roast. Ships this week.",
  "content": [
    {
      "position": 2,
      "elements": [
        {
          "position": 1,
          "type": "image",
          "imageContent": {
            "source_url": "https://northwind.example/img/autumn.jpg",
            "alt": "A bag of Autumn blend coffee beside a steaming mug"
          }
        },
        {
          "position": 2,
          "type": "text",
          "text": "Meet the Autumn blend\nCaramel, toasted pecan and a clean finish."
        },
        {
          "position": 3,
          "type": "button",
          "text": "Shop the blend",
          "link": {
            "url": "https://northwind.example/autumn"
          }
        }
      ]
    }
  ]
}
```

A report: the new draft's edit link, what was applied, anything declined by a guardrail (with the reason), images still missing, the new `save_version`, and a rendered preview shown in the chat.

## 6. stensul-run-quality-check

The prompt asked for the accessibility check.

```json
{
  "emailId": "64f0c0ffee0000000000ef01"
}
```

`errors`: each with a message, a rule and a location such as "the 2nd image in the 3rd module". Empty when everything passes.
