Skip to content

System Functions

Reserved namespaces and built-in functions


Function names beginning with mesh. are reserved for system functions. Applications MUST NOT define functions in this namespace.

System functions provide protocol-level capabilities like health checks, introspection, and operation management.


  • Function names starting with mesh. are reserved
  • Applications MUST NOT define custom functions with this prefix
  • Servers SHOULD implement core system functions
  • Clients MAY call system functions like any other function
mesh.<category>.<action>

Categories:

  • mesh.ping — Simple connectivity check
  • mesh.health — Comprehensive health check
  • mesh.describe — Introspection
  • mesh.capabilities — Feature discovery
  • mesh.operation.* — Async operation management

Health check function. MUST return immediately if service is healthy.

Request:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_health",
"call": {
"function": "mesh.ping",
"version": "1",
"arguments": {}
}
}

Response:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_health",
"result": {
"status": "healthy",
"timestamp": "2024-01-15T10:30:00Z"
},
"meta": {
"node": "orders-api-2",
"duration": { "value": 1, "unit": "millisecond" }
}
}

Arguments: None required

Returns:

FieldTypeDescription
statusstringHealth status: MUST be one of healthy, degraded, unhealthy
timestampstringMUST be ISO 8601 timestamp
detailsobjectOPTIONAL additional health info

Comprehensive health check with component-level status. Use for load balancer health checks, dependency monitoring, and operational visibility.

Request:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_health",
"call": {
"function": "mesh.health",
"version": "1",
"arguments": {}
}
}

Response:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_health",
"result": {
"status": "healthy",
"components": {
"database": {
"status": "healthy",
"latency": { "value": 2, "unit": "millisecond" }
},
"cache": {
"status": "healthy",
"latency": { "value": 1, "unit": "millisecond" }
},
"queue": {
"status": "healthy"
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
}

Arguments:

FieldTypeRequiredDescription
componentstringNoCheck specific component only
include_detailsbooleanNoInclude detailed check info (default: true)

Returns:

FieldTypeDescription
statusstringAggregate status (see below)
componentsobjectComponent health status
functionsobjectFunction-level health (optional)
timestampstringISO 8601 timestamp
versionstringOptional service version
StatusDescriptionHTTP Equivalent
healthyAll systems operational200
degradedFunctional but impaired200
unhealthyNot able to serve requests503

Each component in components contains:

FieldTypeDescription
statusstringComponent status
latencyobjectOptional response time
messagestringOptional status message
last_checkstringOptional last successful check time

The top-level status MUST reflect the worst component status:

  • If ANY component is unhealthy → aggregate is unhealthy
  • If ANY component is degraded (and none unhealthy) → aggregate is degraded
  • If ALL components are healthy → aggregate is healthy
// Request
{
"call": {
"function": "mesh.health",
"version": "1",
"arguments": {
"component": "database"
}
}
}
// Response
{
"result": {
"status": "healthy",
"components": {
"database": {
"status": "healthy",
"latency": { "value": 2, "unit": "millisecond" },
"message": "Primary connection active"
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
}
{
"result": {
"status": "degraded",
"components": {
"database": {
"status": "healthy",
"latency": { "value": 3, "unit": "millisecond" }
},
"cache": {
"status": "degraded",
"message": "Failover to secondary, elevated latency",
"latency": { "value": 45, "unit": "millisecond" }
},
"external_api": {
"status": "healthy"
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
}
{
"result": {
"status": "unhealthy",
"components": {
"database": {
"status": "unhealthy",
"message": "Connection refused",
"last_check": "2024-01-15T10:29:55Z"
},
"cache": {
"status": "healthy"
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
}

For Kubernetes-style probes, use the component argument:

ProbeComponentPurpose
Liveness"self"Is the process alive?
Readiness(omit)Can it serve traffic?
// Liveness probe - just checks if service is running
{
"arguments": {
"component": "self",
"include_details": false
}
}
// Response
{
"result": {
"status": "healthy",
"timestamp": "2024-01-15T10:30:00Z"
}
}

Services SHOULD use these component names when applicable:

ComponentDescription
selfThe service process itself
databasePrimary database
cacheCaching layer (Redis, Memcached)
queueMessage queue
storageObject/file storage
searchSearch engine (Elasticsearch)
<service>_apiExternal service dependency

Functions can report their own health status independently of component health. This enables graceful degradation where some functions remain available while others are temporarily disabled.

FieldTypeDescription
statusstringFunction status (see below)
messagestringOptional explanation
untilstringOptional ISO 8601 timestamp
retry_afterobjectOptional duration before retry
StatusDescription
healthyFunction is fully operational
degradedFunction works but with limitations
disabledFunction temporarily unavailable
{
"result": {
"status": "degraded",
"components": {
"database": { "status": "healthy" },
"cache": { "status": "healthy" }
},
"functions": {
"reports.generate": {
"status": "disabled",
"message": "Disabled during maintenance window",
"until": "2024-01-15T12:00:00Z"
},
"orders.create": {
"status": "healthy"
},
"orders.list": {
"status": "healthy"
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
}
{
"result": {
"status": "degraded",
"components": {
"database": { "status": "healthy" },
"external_api": { "status": "degraded" }
},
"functions": {
"orders.create": {
"status": "degraded",
"message": "Payment validation disabled, orders require manual review"
},
"exports.create": {
"status": "degraded",
"message": "Rate limited due to high load",
"retry_after": { "value": 30, "unit": "second" }
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
}

Function health contributes to aggregate status:

  • If ANY function is disabled → aggregate is at least degraded
  • Function degraded → aggregate is at least degraded
  • Component unhealthy always takes precedence → aggregate is unhealthy

When a function is marked disabled, calls to that function SHOULD return:

{
"errors": [{
"code": "FUNCTION_DISABLED",
"message": "Disabled for scheduled maintenance",
"retryable": true,
"details": {
"function": "reports.generate",
"until": "2024-01-15T12:00:00Z"
}
}]
}

Discover what the service supports.

Request:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_caps",
"call": {
"function": "mesh.capabilities",
"version": "1",
"arguments": {}
}
}

Response:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_caps",
"result": {
"service": "orders-api",
"protocol_versions": ["0.1.0"],
"extensions": [
{
"urn": "urn:mesh:ext:async",
"documentation": "urn:mesh:ext:async"
}
],
"functions": [
"orders.create",
"orders.get",
"orders.list",
"orders.cancel"
],
"limits": {
"max_request_bytes": 1048576,
"default_deadline": { "value": 30, "unit": "second" }
}
}
}

Arguments: None required

Returns:

FieldTypeDescription
servicestringService identifier
protocol_versionsarraySupported Mesh protocol versions
extensionsarraySupported extensions
functionsarrayAvailable function names (without versions)
limitsobjectService limits

Get detailed information about a specific function, including schema, operation type, and capabilities.

Request:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_describe",
"call": {
"function": "mesh.describe",
"version": "1",
"arguments": {
"function": "orders.create"
}
}
}

Response:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_describe",
"result": {
"function": "orders.create",
"description": "Create a new order",
"operation": "write",
"versions": [
{
"version": "1",
"status": "stable",
"description": "Original version",
"deprecated": {
"reason": "Use version 2 for improved validation",
"sunset": "2025-06-01"
}
},
{
"version": "2",
"status": "stable",
"description": "Current version with improved validation",
"schema": {
"arguments": {
"type": "object",
"properties": {
"customer_id": { "type": "string" },
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"product_id": { "type": "string" },
"quantity": { "type": "integer", "minimum": 1 }
},
"required": ["product_id", "quantity"]
}
},
"shipping_address": { "$ref": "#/definitions/address" }
},
"required": ["customer_id", "items"]
},
"returns": {
"type": "object",
"properties": {
"id": { "type": "string" },
"status": { "type": "string", "enum": ["pending", "confirmed"] },
"total": { "type": "number" }
}
},
"definitions": {
"address": {
"type": "object",
"properties": {
"street": { "type": "string" },
"city": { "type": "string" },
"country_code": { "type": "string", "pattern": "^[A-Z]{2}$" }
}
}
}
}
},
{
"version": "3",
"status": "beta",
"description": "Beta with async support"
}
],
"recommended_version": "2"
}
}

Arguments:

FieldTypeRequiredDescription
functionstringYesFunction name to describe
versionstringNoSpecific version (returns all if omitted)
include_schemabooleanNoInclude JSON Schema (default: true)

Returns:

FieldTypeDescription
functionstringFunction name
descriptionstringHuman-readable description
operationstringOperation type (see below)
versionsarrayAvailable versions with status
recommended_versionstringSuggested version to use

The operation field indicates the function’s effect:

TypeDescriptionIdempotentSafe
readRetrieves data without modificationYesYes
writeCreates or updates dataDependsNo
deleteRemoves dataYesNo

Safe means the operation has no side effects. Idempotent means repeated calls produce the same result.

Each version MAY include a schema object with JSON Schema definitions:

FieldTypeDescription
argumentsobjectJSON Schema for function arguments
returnsobjectJSON Schema for successful result
definitionsobjectShared schema definitions

Schemas use JSON Schema Draft 2020-12 with these extensions:

  • $ref for referencing definitions
  • Standard formats: date-time, email, uri, etc.
StatusDescription
stableProduction-ready, fully supported
betaTesting, MAY change
removedNo longer available (MAY be omitted from list)

Deprecation is indicated by the presence of a deprecated object, not a status value. See Deprecated Object.

For list functions, mesh.describe returns pagination capabilities:

{
"result": {
"function": "orders.list",
"description": "List orders with filtering and pagination",
"operation": "read",
"versions": [
{
"version": "1",
"status": "stable",
"pagination": {
"styles": ["cursor", "offset"],
"default_style": "cursor",
"default_limit": 50,
"max_limit": 100
}
}
],
"recommended_version": "1"
}
}
FieldTypeDescription
stylesarraySupported pagination styles
default_stylestringStyle used when not specified
default_limitintegerItems per page when not specified
max_limitintegerMaximum allowed limit
StyleDescription
cursorOpaque cursor-based pagination
offsetNumeric offset pagination
keysetKey-based pagination (e.g., after_id)

For functions supporting filtering, sorting, and sparse fieldsets:

{
"result": {
"function": "orders.list",
"operation": "read",
"versions": [
{
"version": "1",
"status": "stable",
"capabilities": {
"filters": {
"self": ["id", "status", "created_at", "total_amount"],
"customer": ["id", "type", "country_code"]
},
"sorts": ["created_at", "total_amount", "status"],
"fields": {
"self": ["id", "status", "total_amount", "created_at", "updated_at"],
"customer": ["id", "name", "email"]
},
"relationships": ["customer", "items", "shipments"]
},
"pagination": {
"styles": ["cursor"],
"default_limit": 50,
"max_limit": 100
}
}
]
}
}
FieldTypeDescription
filtersobjectFilterable attributes by resource
sortsarraySortable attributes
fieldsobjectSelectable fields by resource
relationshipsarrayIncludable relationships

Check status of an async operation. See Async.

Request:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_op_status",
"call": {
"function": "mesh.operation.status",
"version": "1",
"arguments": {
"operation_id": "op_xyz789"
}
}
}

Arguments:

FieldTypeRequiredDescription
operation_idstringYesOperation ID to check

Returns: See Async for response format.


Cancel a pending async operation.

Request:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_op_cancel",
"call": {
"function": "mesh.operation.cancel",
"version": "1",
"arguments": {
"operation_id": "op_xyz789"
}
}
}

Arguments:

FieldTypeRequiredDescription
operation_idstringYesOperation ID to cancel

Returns:

FieldTypeDescription
operation_idstringOperation ID
statusstringNew status (MUST be cancelled)
cancelled_atstringMUST be ISO 8601 timestamp

List operations for the current caller.

Request:

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_op_list",
"call": {
"function": "mesh.operation.list",
"version": "1",
"arguments": {
"status": "processing",
"limit": 10
}
}
}

Arguments:

FieldTypeRequiredDescription
statusstringNoFilter by status
functionstringNoFilter by function name
limitintegerNoMax results (default 50)
cursorstringNoPagination cursor

Returns:

{
"operations": [
{
"id": "op_abc123",
"function": "reports.generate",
"version": "1",
"status": "processing",
"progress": 0.45,
"started_at": "2024-01-15T10:30:00Z"
},
{
"id": "op_def456",
"function": "exports.create",
"version": "1",
"status": "processing",
"progress": 0.12,
"started_at": "2024-01-15T10:31:00Z"
}
],
"next_cursor": "eyJpZCI6Im9wX2RlZjQ1NiJ9"
}

These namespaces are reserved for potential future use:

NamespaceIntended Purpose
mesh.auth.*Authentication functions
mesh.schema.*Schema introspection
mesh.metrics.*Metrics and observability
mesh.config.*Configuration discovery

Servers SHOULD implement:

  • mesh.ping — Simple connectivity check
  • mesh.health — Comprehensive health check

Servers SHOULD implement if applicable:

  • mesh.capabilities — For service discovery
  • mesh.describe — For API exploration
  • mesh.operation.* — If supporting async operations
FunctionPurposeUse Case
mesh.pingFast connectivity checkHeartbeats, basic liveness
mesh.healthDependency-aware healthLoad balancers, readiness probes

Use mesh.ping when you just need to know if the service is reachable. Use mesh.health when you need to know if the service can actually serve requests (dependencies are healthy).

Organizations MAY define additional system functions within their own namespace:

myorg.system.audit
myorg.system.config

These MUST NOT use the mesh. prefix.


// Request
{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "health_001",
"call": {
"function": "mesh.ping",
"version": "1"
}
}
// Response
{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "health_001",
"result": {
"status": "healthy",
"timestamp": "2024-01-15T10:30:00Z",
"details": {
"database": "connected",
"cache": "connected",
"queue": "connected"
}
}
}
// Request
{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "discover_001",
"call": {
"function": "mesh.capabilities",
"version": "1"
}
}
// Response
{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "discover_001",
"result": {
"service": "user-service",
"protocol_versions": ["0.1.0"],
"extensions": [
{ "urn": "urn:mesh:ext:async" }
],
"functions": [
"users.create",
"users.get",
"users.update",
"users.delete",
"users.list"
],
"limits": {
"default_deadline": { "value": 10, "unit": "second" }
}
}
}
{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "health_002",
"result": {
"status": "degraded",
"timestamp": "2024-01-15T10:30:00Z",
"details": {
"database": "connected",
"cache": "disconnected",
"queue": "connected"
},
"message": "Cache unavailable, operating with degraded performance"
}
}