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
- Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
- Choose your integration method: MCP protocol or REST API.
Connect via MCP
Add to your MCP client config (Claude Desktop, Cursor, etc.):
{
"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.
| Parameter | Type | Required | Description |
|---|---|---|---|
value | number | required | The numeric value to convert. |
from_unit | string | required | Source unit (e.g. 'kilometer', 'pound', 'fahrenheit'). |
to_unit | string | required | Target 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
category | string | required | Category 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'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (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.