← All tool references

Cooking · execute

Sugar Weight Converter

Convert granulated, packed brown, or powdered sugar between grams, ounces, pounds, cups, tablespoons, and teaspoons.

Open public tool

Overview

Category
Cooking
API mode
execute
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/sugar-weight-converter

View this descriptor as JSON

Execute availability

This tool has an execute route defined by its descriptor. Server-side execution is currently unavailable, so requests return api_not_launched.

POST /api/v1/tools/sugar-weight-converter/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.

amount · number · required
No field description is available.
ingredient · string · required
No field description is available. Accepted values: granulated_sugar, brown_sugar_packed, powdered_sugar.
from_unit · string · required
No field description is available. Accepted values: g, oz, lb, cup, tbsp, tsp.
to_unit · string · required
No field description is available. Accepted values: g, oz, lb, cup, tbsp, tsp.
{
    "type": "object",
    "properties": {
        "amount": {
            "type": "number"
        },
        "ingredient": {
            "type": "string",
            "enum": [
                "granulated_sugar",
                "brown_sugar_packed",
                "powdered_sugar"
            ]
        },
        "from_unit": {
            "type": "string",
            "enum": [
                "g",
                "oz",
                "lb",
                "cup",
                "tbsp",
                "tsp"
            ]
        },
        "to_unit": {
            "type": "string",
            "enum": [
                "g",
                "oz",
                "lb",
                "cup",
                "tbsp",
                "tsp"
            ]
        }
    },
    "required": [
        "amount",
        "ingredient",
        "from_unit",
        "to_unit"
    ],
    "additionalProperties": false
}

Output schema

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

result · number
Converted culinary measurement.
density_grams_per_cup · number
Browser-calculated density grams per cup.
from_unit · string
Browser-calculated from unit.
to_unit · string
Browser-calculated to unit.
{
    "type": "object",
    "properties": {
        "result": {
            "type": "number",
            "description": "Converted culinary measurement."
        },
        "density_grams_per_cup": {
            "type": "number",
            "description": "Browser-calculated density grams per cup."
        },
        "from_unit": {
            "type": "string",
            "description": "Browser-calculated from unit."
        },
        "to_unit": {
            "type": "string",
            "description": "Browser-calculated to unit."
        }
    },
    "additionalProperties": false
}

200 grams granulated sugar to cups

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/sugar-weight-converter/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 200,
    "ingredient": "granulated_sugar",
    "from_unit": "g",
    "to_unit": "cup"
}'
{
    "ok": true,
    "data": {
        "slug": "sugar-weight-converter",
        "result": {
            "values": {
                "result": 1,
                "density_grams_per_cup": 200,
                "from_unit": "g",
                "to_unit": "cup"
            },
            "display": {
                "display": "1"
            },
            "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.