# Migraine Treatment Optimization Questionnaire-4 (mTOQ-4)

mTOQ-4

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/mtoq_4`
HTML: https://magentlab.com/docs/mtoq-4
Markdown: https://magentlab.com/docs/mtoq-4.md

Not a medical device. Not a diagnosis, dose, or listing recommendation.

## What it computes

Sum four caller-assigned Lipton 2015 mTOQ-4 frequency items and return the 0-8 total and published treatment-efficacy bands.

## When to use

When an agent has already assigned the four Lipton 2015 frequency tokens and needs the published mTOQ-4 total and efficacy band, not a migraine diagnosis, abortive-drug order, or patient interview.

## When not to use

- Not a medical device and not a diagnosis.
- Not an abortive-drug order.
- magent does not interview the patient.
- pain_free_2h, sustained_24h, able_to_plan, and in_control are caller-assigned Lipton 2015 frequency tokens (never=0, rarely=0, less_than_half=1, half_or_greater=2). magent does not assign the frequencies.
- This is the 4-item Lipton 2015 instrument only (table e-1 / methods cuts very_poor 0, poor 1-5, moderate 6-7, maximum 8). magent does not score the 19-item or 6-item mTOQ.

## Formula

```
mTOQ-4 = pain_free_2h + sustained_24h + able_to_plan + in_control; each never=0, rarely=0, less_than_half=1, half_or_greater=2; max 8; very_poor=0, poor=1-5, moderate=6-7, maximum=8
```

## Citation

[Ineffective acute treatment of episodic migraine is associated with new-onset chronic migraine](https://doi.org/10.1212/WNL.0000000000001256)
Lipton RB, Fanning KM, Serrano D, Reed ML, Cady R, Buse DC
Neurology. 2015;84(7):688-695
DOI: [10.1212/WNL.0000000000001256](https://doi.org/10.1212/WNL.0000000000001256)

## Worked example

### All four never

Given: `able_to_plan=never, in_control=never, pain_free_2h=never, sustained_24h=never`

1. pain_free_2h never 0 + sustained_24h never 0 + able_to_plan never 0 + in_control never 0
2. Score = 0 (max 8); treatment_efficacy very_poor


### Three half_or_greater, one never

Given: `able_to_plan=half_or_greater, in_control=never, pain_free_2h=half_or_greater, sustained_24h=half_or_greater`

1. pain_free_2h 2 + sustained_24h 2 + able_to_plan 2 + in_control never 0
2. Score = 6 (max 8); treatment_efficacy moderate


### All four half_or_greater

Given: `able_to_plan=half_or_greater, in_control=half_or_greater, pain_free_2h=half_or_greater, sustained_24h=half_or_greater`

1. pain_free_2h 2 + sustained_24h 2 + able_to_plan 2 + in_control 2
2. Score = 8 (max 8); treatment_efficacy maximum


## Also searched as

- mTOQ-4
- Migraine Treatment Optimization Questionnaire
- Lipton mTOQ
- migraine treatment optimization
- mTOQ 4 item
- acute migraine treatment efficacy
- mTOQ-4 score
- Lipton 2015 mTOQ-4

## Parameters

- `pain_free_2h` (string, required): Caller-assigned Lipton 2015 mTOQ-4 item 1. After taking your migraine medication, are you pain-free within 2 hours for most attacks? never=0, rarely=0, less_than_half=1, half_or_greater=2. magent does not interview the patient.
- `sustained_24h` (string, required): Caller-assigned Lipton 2015 mTOQ-4 item 2. Does one dose of your migraine medication usually relieve your headache and keep it away for at least 24 hours? never=0, rarely=0, less_than_half=1, half_or_greater=2. magent does not interview the patient.
- `able_to_plan` (string, required): Caller-assigned Lipton 2015 mTOQ-4 item 3. Are you comfortable enough with your migraine medication to be able to plan your daily activities? never=0, rarely=0, less_than_half=1, half_or_greater=2. magent does not interview the patient.
- `in_control` (string, required): Caller-assigned Lipton 2015 mTOQ-4 item 4. After taking your migraine medication, do you feel in control of your migraines enough so that you feel you can return to normal function? never=0, rarely=0, less_than_half=1, half_or_greater=2. magent does not interview the patient.

## Bulk (POST)

POST the same path with a JSON items array. The first item is the GET unit; each additional item is $0.002. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/mtoq_4`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- POST of 1 item costs the same as GET. Lists longer than 25: chunk into multiple POSTs. Extra items still execute; do not pad dummy rows.
- The first invalid item fails the whole request (index in the 400 JSON). You are not charged.
- HTTP 200 is {count, path, items}. Each items[i] is the GET 200 body for that row.
- Catalog misses (empty matches, found=false) stay paid 200s inside that slot.
- x402 resource URL is this path plus n and body_sha256. Browsers that prefer text/html get the same paywall as GET; Pay retries POST with the same items.

Example request:

```json
{
  "items": [
    {
      "able_to_plan": "never",
      "in_control": "never",
      "pain_free_2h": "never",
      "sustained_24h": "never"
    },
    {
      "able_to_plan": "never",
      "in_control": "never",
      "pain_free_2h": "never",
      "sustained_24h": "never"
    }
  ]
}
```

Human paywall (two-item fixture): https://api.magentlab.com/paywall/bulk/mtoq-4

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/mtoq_4",
  "items": [
    {
      "components": [
        {
          "value": "never",
          "factor": "pain_free_2h",
          "points": 0,
          "present": true
        },
        {
          "value": "never",
          "factor": "sustained_24h",
          "points": 0,
          "present": true
        },
        {
          "value": "never",
          "factor": "able_to_plan",
          "points": 0,
          "present": true
        },
        {
          "value": "never",
          "factor": "in_control",
          "points": 0,
          "present": true
        }
      ],
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Lipton RB, Fanning KM, Serrano D, Reed ML, Cady R, Buse DC",
        "doi": "10.1212/WNL.0000000000001256",
        "id": "lipton-2015",
        "pmid": "25616416",
        "source": "Neurology. 2015;84(7):688-695",
        "title": "Ineffective acute treatment of episodic migraine is associated with new-onset chronic migraine"
      },
      "formula": "mtoq_4",
      "formula_expression": "mTOQ-4 = pain_free_2h + sustained_24h + able_to_plan + in_control; each never=0, rarely=0, less_than_half=1, half_or_greater=2; max 8; very_poor=0, poor=1-5, moderate=6-7, maximum=8",
      "max_score": 8,
      "score": 0,
      "treatment_efficacy": "very_poor"
    },
    {
      "components": [
        {
          "value": "never",
          "factor": "pain_free_2h",
          "points": 0,
          "present": true
        },
        {
          "value": "never",
          "factor": "sustained_24h",
          "points": 0,
          "present": true
        },
        {
          "value": "never",
          "factor": "able_to_plan",
          "points": 0,
          "present": true
        },
        {
          "value": "never",
          "factor": "in_control",
          "points": 0,
          "present": true
        }
      ],
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Lipton RB, Fanning KM, Serrano D, Reed ML, Cady R, Buse DC",
        "doi": "10.1212/WNL.0000000000001256",
        "id": "lipton-2015",
        "pmid": "25616416",
        "source": "Neurology. 2015;84(7):688-695",
        "title": "Ineffective acute treatment of episodic migraine is associated with new-onset chronic migraine"
      },
      "formula": "mtoq_4",
      "formula_expression": "mTOQ-4 = pain_free_2h + sustained_24h + able_to_plan + in_control; each never=0, rarely=0, less_than_half=1, half_or_greater=2; max 8; very_poor=0, poor=1-5, moderate=6-7, maximum=8",
      "max_score": 8,
      "score": 0,
      "treatment_efficacy": "very_poor"
    }
  ]
}
```

## Response fields

- `formula` (string): mtoq_4
- `formula_expression` (string): Exact expression used
- `score` (integer): mTOQ-4 points 0-8
- `max_score` (integer): 8
- `treatment_efficacy` (string): Lipton 2015 efficacy band: very_poor (0), poor (1-5), moderate (6-7), or maximum (8). Not a diagnosis.
- `components` (array): Per-item caller-assigned points
- `citation` (object): Lipton et al. Neurology 2015 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": "never",
      "factor": "pain_free_2h",
      "points": 0,
      "present": true
    },
    {
      "value": "never",
      "factor": "sustained_24h",
      "points": 0,
      "present": true
    },
    {
      "value": "never",
      "factor": "able_to_plan",
      "points": 0,
      "present": true
    },
    {
      "value": "never",
      "factor": "in_control",
      "points": 0,
      "present": true
    }
  ],
  "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
  "citation": {
    "authors": "Lipton RB, Fanning KM, Serrano D, Reed ML, Cady R, Buse DC",
    "doi": "10.1212/WNL.0000000000001256",
    "id": "lipton-2015",
    "pmid": "25616416",
    "source": "Neurology. 2015;84(7):688-695",
    "title": "Ineffective acute treatment of episodic migraine is associated with new-onset chronic migraine"
  },
  "formula": "mtoq_4",
  "formula_expression": "mTOQ-4 = pain_free_2h + sustained_24h + able_to_plan + in_control; each never=0, rarely=0, less_than_half=1, half_or_greater=2; max 8; very_poor=0, poor=1-5, moderate=6-7, maximum=8",
  "max_score": 8,
  "score": 0,
  "treatment_efficacy": "very_poor"
}
```

## Errors

- HTTP 400 `invalid_mtoq4`: mTOQ-4 items must each be never, rarely, less_than_half, or half_or_greater (Lipton 2015). Returned before settlement; you are not charged.
- HTTP 400 `invalid_items`: POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
- HTTP 400 `invalid_item_count`: items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
- HTTP 400 `invalid_item`: each items entry must be a JSON object Returned before settlement; you are not charged.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- [MIDAS](https://magentlab.com/docs/midas) — Sum five caller-assigned MIDAS day counts over the last 3 months and return the 0-450 total and published grades I–IV.
- [Modified Rankin](https://magentlab.com/docs/modified-rankin) — Return the van Swieten 1988 modified Rankin handicap grade 0-5 from a caller-assigned integer, with the published grade wording.

## Payment

Unpaid requests return HTTP 402 even if query parameters or POST items are missing or invalid, so CDP and agents can index the path. After a PAYMENT-SIGNATURE, invalid params return HTTP 400 JSON before settlement. magent does not charge. Fix the params, then request a new 402 quote for that complete URL. Catalog misses (empty matches, found=false) are valid paid 200s.

- GET the tool with Accept: application/json (do not send Accept: text/html unless you want the human paywall).
- HTTP 402 means you have not paid. Decode the base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote.
- Sign accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact nonce only after a new HTTP 402.

- offered `exact` on eip155:8453: Fixed-price USDC on Base. The buyer authorizes the advertised amount (EIP-3009). magent settles before the tool runs (paymentFlow upfront). extra.assetTransferMethod=eip3009 extra.paymentFlow=upfront.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

- not offered `upto`: Not offered. Usage-based: buyer authorizes a ceiling, seller settles the actual amount after work. Reserved for a future metered tool. Not for current calculators or code search.

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. That is not x402 batch-settlement (payment channels / vouchers).

Shared HTTP 402 and 503 table: https://magentlab.com/docs/payments

Stdio MCP (one process per host): https://magentlab.com/docs/mcp

## Guarantees

- HTTP 402 is unpaid, including a missing query. After PAYMENT-SIGNATURE, invalid parameters return HTTP 400 before settlement. You are not charged. HTTP 402 never includes the tool JSON.
- exact: settlement finishes before the tool (paymentFlow upfront). batch-settlement: verify/deposit before the tool; chargedCumulativeAmount commits after HTTP 2xx. Uncertain or failed settlement fails closed (HTTP 503). Retry the same PAYMENT-SIGNATURE.
- HTTP 402 is unpaid only. Do not sign a second authorization because of a 503.
- Execution is timeout-bounded and concurrency-capped.
- Calculator inputs are stored encrypted for allowlisted operators (Magent Console). They are not in public logs, SSH lookups, catalog, or rollups. Request logs store path without query.
