MAGENT

WEDGE

FIB-4

Deterministic fibrosis index from age, AST, ALT, and platelets. Not a diagnosis.

WEDGE $0.005 USDC GET /api/calc/fib4

When to use

FIB-4 fibrosis index from age, AST, ALT, and platelets. Use for MASH/NASH prior-auth arithmetic. Deterministic published index with citation; not a diagnosis.

Try

Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.

/api/calc/fib4?age=50&ast_u_l=100&alt_u_l=40&platelets_10e9_l=200

Full URL: https://api.magentlab.com/api/calc/fib4?age=50&ast_u_l=100&alt_u_l=40&platelets_10e9_l=200

Request

GET /api/calc/fib4 · x402 V2 · USDC on Base · $0.005 USDC

x402 V2 curl

Expect HTTP 402 and a PAYMENT-REQUIRED header until you retry with PAYMENT-SIGNATURE.

curl -i -H "Accept: application/json" "https://api.magentlab.com/api/calc/fib4?age=50&ast_u_l=100&alt_u_l=40&platelets_10e9_l=200"

Cursor mcp.json

Intended config for @magent/mcp. This is not npm @x402/fetch (a payment fetch wrapper).

{
  "mcpServers": {
    "magent": {
      "args": [
        "-y",
        "@magent/mcp"
      ],
      "command": "npx",
      "env": {
        "X402_PRIVATE_KEY": "0xYOUR_SPENDING_KEY"
      }
    }
  }
}

Query parameters

Name Type Required Description
age integer required Age in years (18-120).
ast_u_l number required Aspartate aminotransferase in U/L (1-10000).
alt_u_l number required Alanine aminotransferase in U/L (1-10000).
platelets_10e9_l number required Platelet count in 10^9/L (1-2000).

Success fields

Field Type Description
formula string fib4
formula_expression string Exact expression used
age_years integer Age used in the equation
ast_u_l number AST in U/L
alt_u_l number ALT in U/L
platelets_10e9_l number Platelets in 10^9/L
fib4 number FIB-4 index, 2 decimal places
sterling_band string Published Sterling 2006 cut-points: low (<1.45), indeterminate (1.45-3.25), high (>3.25). Not a diagnosis.
citation object Hepatology 2006 citation
disclaimer string Not-a-device notice

Example

Frozen fixture. Not a live lookup.

{
  "disclaimer": "Not a medical device. Deterministic published-formula or coded-ontology output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
  "age_years": 50,
  "citation": {
    "authors": "Sterling RK, Lissen E, Clumeck N, et al.",
    "doi": "10.1002/hep.21172",
    "id": "sterling-2006",
    "source": "Hepatology. 2006;43(6):1317-1325",
    "title": "Development of a simple noninvasive index to predict significant fibrosis in patients with HIV/HCV coinfection"
  },
  "formula": "fib4",
  "formula_expression": "FIB-4 = (age_years * AST_U_L) / (platelets_10e9_L * sqrt(ALT_U_L))",
  "alt_u_l": 40.0,
  "ast_u_l": 100.0,
  "fib4": 3.95,
  "platelets_10e9_l": 200.0,
  "sterling_band": "high"
}

Payment

Unpaid requests return HTTP 402 with a base64 PAYMENT-REQUIRED header. Retry the same URL with PAYMENT-SIGNATURE. Settlement completes before the tool runs. Full handshake and shared payment errors: Payments.

Errors

HTTP Code When
400 invalid_age age must be an integer from 18 to 120
400 invalid_ast ast_u_l must be a number from 1 to 10000
400 invalid_alt alt_u_l must be a number from 1 to 10000
400 invalid_platelets platelets_10e9_l must be a number from 1 to 2000
402 payment_required Missing or invalid PAYMENT-SIGNATURE; decode the PAYMENT-REQUIRED header
409 payment_in_progress The same authorization nonce is already being settled; retry shortly
429 rate_limited Too many requests from this client
503 settlement_uncertain Settlement is unconfirmed; retry with the same PAYMENT-SIGNATURE
503 facilitator_unavailable Payment facilitator unavailable
503 facilitator_misconfigured Payment facilitator is not configured
503 facilitator_unauthorized Payment facilitator rejected credentials
503 ledger_unavailable Payment ledger unavailable
503 payment_unavailable Payment processing unavailable

Guarantees

  • Settlement finishes before the tool executes. Uncertain settlement fails closed (HTTP 503).
  • Lookups run on our nodes — no third-party data API wrappers.
  • Localhost, IP literals, and metadata hostnames are rejected.
  • Execution is timeout-bounded and concurrency-capped.