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.
Quick start
Call this tool from your code in three languages.
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
POST https://api.elysiatools.com/en/api/tools/anion-gap-calculatorParameters
| Name | Type | Required | Description |
|---|---|---|---|
| includePotassium | checkbox | No | Use AG = Na⁺ + K⁺ − Cl⁻ − HCO₃⁻. Reference range shifts up to roughly 10–20 mmol/L. |
| sodium | number | Yes | Serum sodium (mmol/L). Physiologic range ~120–160. |
| chloride | number | Yes | Serum chloride (mmol/L). Physiologic range ~80–130. |
| bicarbonate | number | Yes | Serum bicarbonate / total CO₂ (mmol/L). Physiologic range ~5–50. |
| potassium | number |
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:
{
"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:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Call this tool
Invoke the tool by its id, passing arguments built from its parameters:
{
"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
}
}
}