Elysia Tools Docs
EN
Language
ZHESPTRUFRDEEN
Back to site
Browse tools

Health

Serum Anion Gap (AG) Calculator

Calculate the serum Anion Gap (AG) to classify metabolic acidosis. Standard formula AG = Na⁺ − Cl⁻ − HCO₃⁻ (mmol/L), or AG = Na⁺ + K⁺ − Cl⁻ − HCO₃⁻ with optional potassium. A high AG (≈ >12, or >20 with K⁺) indicates accumulation of unmeasured anions (lactic acidosis, ketoacidosis, renal failure, and toxins such as methanol/ethylene glycol, salicylates — mnemonic GOLD-MARK). A normal AG (8–12) during metabolic acidosis points to a hyperchloremic (normal-anion-gap) acidosis: diarrhea, renal tubular acidosis, saline resuscitation. A low AG (<3–6) is usually hypoalbuminemia, also hypercalcemia/hypermagnesemia, lithium, cationic IgG paraproteins, or bromide pseudo-hyperchloraemia. Optional albumin correction AG_corrected = AG + 2.5 × (4.0 − albumin g/dL) avoids missing a high-AG acidosis in hypoalbuminemia. Derived from Kraut CJASN 2007, Figge 1998, and MDCalc. Interpret with blood gas and full clinical context. Not medical advice.

json· JSON resultOpen tool

Quick start

Call this tool from your code in three languages.

cURL
curl -X POST 'https://api.elysiatools.com/en/api/tools/anion-gap-calculator' \
  -H 'Content-Type: application/json' \
  -d '{"includePotassium":false,"sodium":140,"chloride":104,"bicarbonate":10,"potassium":0,"albumin":0,"decimalPlaces":1}'

API reference

Send a POST request with your inputs as JSON. File parameters require a separate upload first.

Endpoint

HTTP
POST https://api.elysiatools.com/en/api/tools/anion-gap-calculator

Parameters

NameTypeRequiredDescription
includePotassiumcheckboxNoUse AG = Na⁺ + K⁺ − Cl⁻ − HCO₃⁻. Reference range shifts up to roughly 10–20 mmol/L.
sodiumnumberYesSerum sodium (mmol/L). Physiologic range ~120–160.
chloridenumberYesSerum chloride (mmol/L). Physiologic range ~80–130.
bicarbonatenumberYesSerum bicarbonate / total CO₂ (mmol/L). Physiologic range ~5–50.
potassiumnumber

MCP integration

Add this tool to your Model Context Protocol server so AI agents can list and call it.

Server configuration

Add this block to your MCP client configuration:

mcp.json
{
  "mcpServers": {
    "elysiatools-anion-gap-calculator": {
      "name": "anion-gap-calculator",
      "description": "Calculate the serum Anion Gap (AG) to classify metabolic acidosis. Standard formula AG = Na⁺ − Cl⁻ − HCO₃⁻ (mmol/L), or AG = Na⁺ + K⁺ − Cl⁻ − HCO₃⁻ with optional potassium. A high AG (≈ >12, or >20 with K⁺) indicates accumulation of unmeasured anions (lactic acidosis, ketoacidosis, renal failure, and toxins such as methanol/ethylene glycol, salicylates — mnemonic GOLD-MARK). A normal AG (8–12) during metabolic acidosis points to a hyperchloremic (normal-anion-gap) acidosis: diarrhea, renal tubular acidosis, saline resuscitation. A low AG (<3–6) is usually hypoalbuminemia, also hypercalcemia/hypermagnesemia, lithium, cationic IgG paraproteins, or bromide pseudo-hyperchloraemia. Optional albumin correction AG_corrected = AG + 2.5 × (4.0 − albumin g/dL) avoids missing a high-AG acidosis in hypoalbuminemia. Derived from Kraut CJASN 2007, Figge 1998, and MDCalc. Interpret with blood gas and full clinical context. Not medical advice.",
      "baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=anion-gap-calculator",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

List available tools

After connecting to the SSE endpoint, list the exposed tools:

tools/list
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

Call this tool

Invoke the tool by its id, passing arguments built from its parameters:

tools/call
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "anion-gap-calculator",
    "arguments": {
  "includePotassium": false,
  "sodium": 140,
  "chloride": 104,
  "bicarbonate": 10,
  "potassium": 0,
  "albumin": 0,
  "decimalPlaces": 1
}
  }
}
Browse toolsOpen tool

© 2026 Elysia Tools. Developer documentation.

Back to siteBrowse tools
No
Serum potassium (mmol/L). Required only when 'Include Potassium K⁺' is checked.
albuminnumberNoSerum albumin (g/dL). If provided, computes albumin-corrected AG: AG_corr = AG + 2.5 × (4.0 − albumin).
decimalPlacesnumberNo—

Response format

JSON result

JSON
{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
Chain multiple tools in one session with a comma-separated toolId list, e.g. /mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp (max 20).

Questions or issues? Contact [email protected]