GnistAI GnistAI
Log in

Getting Started with Unit Conversion

Convert between units across 10 categories — length, mass, volume, area, speed, time, temperature, digital storage, energy, and pressure.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Utilities

Data source: Built-in conversion factors

Overview

Unit Conversion performs computations on your inputs — no external data source required. This tutorial covers all 4 tools with parameter reference and code examples.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-unit-conversion": {
      "url": "https://context.gnist.ai/mcp/unit-conversion/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (4)

convert_units

Convert a value from one unit to another. Supports 10 categories: length, mass, volume, area, speed, time, temperature, digital storage, energy, and pressure. Units must be in the same category (e.g. both length units). Examples: kilometer→mile, pound→kilogram, fahrenheit→celsius, gigabyte→mebibyte, kilowatt_hour→btu, psi→bar.

ParameterTypeRequiredDescription
valuenumberrequiredThe numeric value to convert.
from_unitstringrequiredSource unit (e.g. 'kilometer', 'pound', 'fahrenheit').
to_unitstringrequiredTarget unit (e.g. 'mile', 'kilogram', 'celsius').
curl -X POST "https://context.gnist.ai/mcp/unit-conversion/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "convert_units", "arguments": {"value": 1.0, "from_unit": "'kilometer'", "to_unit": "'mile'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/unit-conversion/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'from_unit': "'kilometer'",
                          'to_unit': "'mile'",
                          'value': 1.0},
            'name': 'convert_units'}},
)
print(resp.json())

list_unit_categories

List all supported unit categories and their units. Returns every category (length, mass, volume, area, speed, time, temperature, digital_storage, energy, pressure) with all available units.

curl -X POST "https://context.gnist.ai/mcp/unit-conversion/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_unit_categories", "arguments": {}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/unit-conversion/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {}, 'name': 'list_unit_categories'}},
)
print(resp.json())

list_units_in_category

List all available units in a specific category.

ParameterTypeRequiredDescription
categorystringrequiredCategory name (e.g. 'length', 'mass', 'temperature').
curl -X POST "https://context.gnist.ai/mcp/unit-conversion/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_units_in_category", "arguments": {"category": "'length'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/unit-conversion/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'category': "'length'"},
            'name': 'list_units_in_category'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/unit-conversion/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/unit-conversion/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

FAQ

What data does Unit Conversion provide?

Convert between units across 10 categories — length, mass, volume, area, speed, time, temperature, digital storage, energy, and pressure. It exposes 4 tools: convert_units, list_unit_categories, list_units_in_category, report_feedback.

Does this toolkit require external data?

No. It performs computations on your inputs directly. You only need a Gnist API key.

What format does the Unit Conversion API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials