# Rockall Pre-Endoscopy Score Calculator (magent)

> Rockall Pre-Endoscopy Score Calculator (magent) is a paid API for AI agents from api.magentlab.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-15).

Calculates the Rockall 1996 pre-endoscopy admission score for acute upper GI haemorrhage from age, blood pressure, heart rate, and comorbidity.

## Facts

- Endpoint: GET https://api.magentlab.com/api/calc/rockall_pre
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/rockall-pre-endoscopy-score-calculator-magent-03be0d10
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4fMqX72KXQV2a_GiYUDY6

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability rockall-pre-endoscopy-score-calculator-magent-03be0d10
```

Example prompt: Calculate the Rockall pre-endoscopy score for a 72-year-old patient with a systolic BP of 88 mmHg, heart rate of 110 bpm, and known ischaemic heart disease — so comorbidity is cardiac.

## When to prefer this

Use this endpoint when you need a fast, explainable pre-endoscopy triage score for acute upper GI haemorrhage and the caller can assign comorbidity category from the clinical record. Prefer over full Rockall when endoscopy findings are not yet available. Not a substitute for AIMS65 or Glasgow-Blatchford if those are needed; choose based on which score is required by the clinical workflow.

## Known failure modes

- Age outside 18–120 range returns validation error
- Heart rate outside 30–220 range returns validation error
- Systolic BP outside 50–250 returns validation error
- Invalid comorbidity string (not 'none', 'cardiac', or 'renal_liver_metastatic') returns error
- Missing required query parameters return 400-level error
- Payment failure (x402) blocks the call if USDC not provided

## How this service works

Rockall 1996 pre-endoscopy (admission) score after acute upper GI haemorrhage: age <60 0, 60-79 1, >=80 2; shock SBP<100 2 (hypotension; tachycardia not added), else HR>=100 1, else 0; comorbidity none 0, cardiac (failure, IHD, or any major) 2, renal/liver/metastatic 3. Max 7. Not complete Rockall, AIMS65, or GBS. Caller assigns comorbidity.

## Output

Returns the integer Rockall pre-endoscopy score (0–7) broken down by component contributions: age band (0–2), shock/haemodynamic status (0–2), and comorbidity tier (0–3). Does not include post-endoscopy Rockall components (stigmata, diagnosis). Not equivalent to full Rockall, AIMS65, or Glasgow-Blatchford.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "queryParams": {
     "type": "object",
     "required": [
      "age",
      "heart_rate_bpm",
      "systolic_mm_hg",
      "comorbidity"
     ],
     "properties": {
      "age": {
       "type": "integer",
       "description": "Age in years (18-120). <60 scores 0; 60-79 scores 1; ≥80 scores 2. 59 does not score; 60 scores 1; 79 scores 1; 80 scores 2."
      },
      "comorbidity": {
       "type": "string",
       "description": "Caller-assigned comorbidity: none (0), cardiac (2; cardiac failure, IHD, or any major comorbidity), or renal_liver_metastatic (3; renal failure, liver failure, or disseminated malignancy). magent does not assign comorbidity."
      },
      "heart_rate_bpm": {
       "type": "integer",
       "description": "Heart rate in beats per minute (integer 30-220). With SBP ≥100, HR ≥100 scores 1 (tachycardia); 99 does not. Not added when SBP <100."
      },
      "systolic_mm_hg": {
       "type": "number",
       "description": "Systolic blood pressure in mm Hg (50-250). SBP <100 scores 2 (hypotension) and tachycardia is not added; 100 does not score hypotension."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "path": "/api/calc/rockall_pre",
  "count": 2,
  "items": [
   {
    "score": 0,
    "formula": "rockall_pre",
    "citation": {
     "id": "rockall-1996",
     "doi": "10.1136/gut.38.3.316",
     "title": "Risk assessment after acute upper gastrointestinal haemorrhage",
     "source": "Gut. 1996;38(3):316-321",
     "authors": "Rockall TA, Logan RF, Devlin HB, Northfield TC"
    },
    "age_years": 50,
    "max_score": 7,
    "components": [
     {
      "value": 50,
      "factor": "age",
      "points": 0,
      "present": false
     },
     {
      "value": {
       "heart_rate_bpm": 80,
       "systolic_mm_hg": 120
      },
      "factor": "shock",
      "points": 0,
      "present": false
     },
     {
      "value": "none",
      "factor": "comorbidity",
      "points": 0,
      "present": false
     }
    ],
    "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.",
    "comorbidity": "none",
    "heart_rate_bpm": 80,
    "systolic_mm_hg": 120,
    "formula_expression": "pre-endoscopy Rockall = age (<60: 0, 60-79: 1, >=80: 2) + shock (SBP<100: 2; else HR>=100: 1; else 0) + comorbidity (none: 0, cardiac: 2, renal_liver_metastatic: 3); max 7"
   },
   {
    "score": 0,
    "formula": "rockall_pre",
    "citation": {
     "id": "rockall-1996",
     "doi": "10.1136/gut.38.3.316",
     "title": "Risk assessment after acute upper gastrointestinal haemorrhage",
     "source": "Gut. 1996;38(3):316-321",
     "authors": "Rockall TA, Logan RF, Devlin HB, Northfield TC"
    },
    "age_years": 50,
    "max_score": 7,
    "components": [
     {
      "value": 50,
      "factor": "age",
      "points": 0,
      "present": false
     },
     {
      "value": {
       "heart_rate_bpm": 80,
       "systolic_mm_hg": 120
      },
      "factor": "shock",
      "points": 0,
      "present": false
     },
     {
      "value": "none",
      "factor": "comorbidity",
      "points": 0,
      "present": false
     }
    ],
    "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.",
    "comorbidity": "none",
    "heart_rate_bpm": 80,
    "systolic_mm_hg": 120,
    "formula_expression": "pre-endoscopy Rockall = age (<60: 0, 60-79: 1, >=80: 2) + shoc
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/rockall-pre-endoscopy-score-calculator-magent-03be0d10/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.magentlab.com](https://www.zero.xyz/host/api.magentlab.com/llms.txt)
