apitell Start free
SPECIFICATION · v1 · $schema https://apitell.com/spec/v1.json

AI Context — the standard Apitell speaks.

One file per versioned API base, published at GET <base>/ai: what the service is, its operations, what the fields mean, worked examples. The service publishes the file and nothing else; search, descriptions, argument checks and calls are the bridge’s work. The wire carries neither “apitell” nor “AI Context” — /ai and X-AI-*, on purpose.

1 · The description — ai-context.json

A service describes every versioned API base it serves in one file, ai-context.json, and publishes it at <base>/ai. There is no global /ai, no discovery document and no registration. The service publishes a file and nothing else: no SDK, no generated index, no batch endpoint. Its own routes answer the calls, behind its own authentication.

key required what it is
$schema no the version the file is written to; none means v1
service{id,title,summary,base,version,build,siblings[]} yes what this base is; base includes the API version, and may be a path — the host is a deployment fact
auth{scheme,header?,note,oauth?} yes where the credential goes on every call (bearer, basic, or a named header), and how to get one
conventions[] no ≤ 8 rules true of every tool
start_here[]{ask,tool,args} no ≤ 5 question classes, each with a tool and arguments that work
topics[]{id,title,body,tools[]} no prose pages: what the schema cannot say
examples[]{ask,calls[],read} no 2 or 3 worked flows: a question, the batch that answers it, how to read the answer
tools[] yes the operations
groups[]{id,title} no families of tools, for a base too large to read at once
paging{arg,size?,sep?,next,more?,rows?} no how the base’s paged tools lead to the next page, declared once
limits{batch{…},per_call{…}} no bounds a caller may rely on
links{docs?,issues?} no human documentation, and where a fault in the file is reported

A key this version does not define is an error, never ignored: a "tolls" dropped in silence is an empty tool list nobody explains.

A tool is one operation — one parameter contract, not one route. It carries name, mode, purpose, the method and path of the HTTP call, an input_schema (and a body_schema for a JSON body), output.fields[] with additive marking what may be summed, its own limits and paging, notes[] and working examples[].

PublishingGET <base>/ai answers the file, the same bytes for every caller: a token decides what a call may return, never what the API is. An ETag and a 304 let a bridge re-check it every few minutes.
mode is not a permissionread, write, write_idempotent, destructive say what a tool does and become MCP annotations. Permission comes from the token; a bridge runs a write only when the session allows it.
Schema subset S1JSON Schema 2020-12 cut to what a validator can check completely: flat properties, enum, bounds, pattern, description. No oneOf, no $ref, no nesting — an object argument is opaque and travels in a body.
VersionsAdding an optional key is not a new version. Renaming, removing or changing what a key means is spec/v2, beside v1, which does not move: a file published against it stays valid.

2 · Where a description comes from

A reader reads a base’s description from GET <base>/ai. Its operator may also give it descriptions in a registry file — {base, spec, sha256} per entry, pinned by checksum — and a base listed there is served from that file without asking <base>/ai. A base with neither is not an AI Context base and is refused as such.

The one security rule: a description may not move the base. A file whose service.base names another host or path is refused, every tools[].path is absolute on the host, and the base’s credential is sent to the base and nowhere else. Without it, “read this base for me” becomes “send my credential wherever this file says”.

3 · What a bridge does

A bridge reads descriptions and serves them to a model. The Apitell bridge does it over MCP with four tools — ai_discover, ai_search, ai_describe, ai_call — and, where a client wants them, one tool per operation. Discovery, search and description never cost a request to the service: the description is already read.

DiscoverThe base's structure: service, tool count, groups, topics, start_here, auth. No prose of the service's own beyond titles. A small base's tools come with it; it needs no search.
SearchTools and topics ranked for a question, 8 and 5 a page, deterministic for one description and one engine (the reference bridge ships BM25).
DescribeNamed tools in full — the schema in canonical form — and named topics with their bodies. A name filed in the wrong list is refused with both lists.
CallUp to 8 calls in one batch, answered in order. Every slot is validated before the first request is sent; reads may run in parallel, a batch with a write runs in order. Each slot is one request to the service's own route, with the caller's credential.

A route that ignores an unknown parameter answers the unfiltered range under a filtered heading, with a 200 and nothing saying the filter was dropped. Validating every argument against the tool’s schema first is what this standard exists for.

Errors are one object, {kind, message, argument?, accepts?[], valid_values?[], min?, max?, hint?, fix?}, with a closed kind:

unknown_parameterunknown_toolinvalid_batchinvalid_argumentmissing_argumentpayload_too_largeresponse_too_largewrite_not_allowedskippedupstream_errorrefused

accepts[] is what makes a refusal recoverable in the same turn. refused is whatever runs in front of a bridge saying no on the user’s behalf — a connector to reconnect, a rate limit — never the API: the API’s own refusals are upstream_error, so a model cannot mistake “the service said no” for “the platform said no”.

fields narrows a call’s answer to the output keys it names, at any depth, and never silently: a body that cannot be narrowed is an error, not the whole body under a call that asked for less. Paging is never followed by the bridge: a paged answer carries next, the arguments for the next page, and the caller decides whether the rows it has not seen are worth a call.

The text view is an optional rendering of the same answers — tables instead of repeated keys, every value escaped so that data cannot draw the frame, nothing ever shortened. A bridge that renders it passes the vectors in examples/textview/.

4 · Conformance

A description is conformant when it decodes under the version it names with no key that version does not define; every rule of the file, the tools, S1 and paging holds; every start_here entry and every example validates as a batch, run dry; and, with a credential, every one of them answers 2xx from the live base.

apitell check <file|base> [--base url] [--live]

runs all of it and exits 1 on the first failure, so it goes in CI.

5 · Examples

file what it is
examples/ai-context.json a complete description: the hood readings base, nine read tools, service.base spelled as a path the way a repository ships it
examples/projection/*.json fields vectors: every implementation of the narrowing passes them byte for byte
examples/textview/*.json + *.md text-view vectors: a batch answer, the fields it was read against, and the text a bridge renders

Schemas

ai-context.schema.json is the machine-readable description of the file: JSON Schema 2020-12, root $ref #/$defs/source, every property carrying a description saying what the key is and who writes it — STRUCTURE, read out of the code and rewritten whenever a route changes, or PROSE, written once by a developer and kept.

Implementations

apitellthe standard: spec, schema, examples, the ai-context skill that writes a file from a service's code, and the registrynot a module · MIT
apitell-mcpthe bridge: one MCP server for any base that serves /ai, over stdio or HTTP, and apitell checkapitell.com/mcp
apitell-tunethe measuring harness: a real model against a real base, read on passk, cost in tokensapitell.com/tune

The spec is versioned by its text and by $schema. Amendments inside v1 live in CHANGELOG.md; the repository carries no release tags.