← All tool references

Health · not_available

Caffeine Calculator

Calculate total caffeine from drink | caffeine mg | servings, daily reference limit.

Open public tool

Overview

Category
Health
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/caffeine-calculator

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/caffeine-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

drinks · string · required
Enter drink | caffeine mg | servings.
reference_limit · number · required
Enter daily reference limit.
{
    "type": "object",
    "properties": {
        "drinks": {
            "type": "string",
            "description": "Enter drink | caffeine mg | servings."
        },
        "reference_limit": {
            "type": "number",
            "description": "Enter daily reference limit."
        }
    },
    "required": [
        "drinks",
        "reference_limit"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

total_caffeine · number
Total caffeine produced by the tool.
reference_share · number
Share of entered reference produced by the tool.
drinks · array
Drink breakdown produced by the tool.
{
    "type": "object",
    "properties": {
        "total_caffeine": {
            "type": "number",
            "description": "Total caffeine produced by the tool."
        },
        "reference_share": {
            "type": "number",
            "description": "Share of entered reference produced by the tool."
        },
        "drinks": {
            "type": "array",
            "description": "Drink breakdown produced by the tool."
        }
    },
    "additionalProperties": false
}

Caffeine Calculator worked example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/caffeine-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "drinks": "Coffee|95|2\nTea|45|1\nSoda|35|1",
    "reference_limit": 400
}'
{
    "ok": true,
    "data": {
        "slug": "caffeine-calculator",
        "result": {
            "values": {
                "total_caffeine": 270,
                "reference_share": 67.5,
                "drinks": [
                    {
                        "drink": "Coffee",
                        "mg_per_serving": 95,
                        "servings": 2,
                        "total_mg": 190
                    },
                    {
                        "drink": "Tea",
                        "mg_per_serving": 45,
                        "servings": 1,
                        "total_mg": 45
                    },
                    {
                        "drink": "Soda",
                        "mg_per_serving": 35,
                        "servings": 1,
                        "total_mg": 35
                    }
                ]
            },
            "display": {
                "display": "270"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.