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[].
GET <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.enum, bounds, pattern, description. No oneOf, no $ref, no nesting — an object argument is opaque and travels in a body.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.
start_here, auth. No prose of the service's own beyond titles. A small base's tools come with it; it needs no search.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_errorrefusedaccepts[] 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
ai-context skill that writes a file from a service's code, and the registrynot a module · MIT/ai, over stdio or HTTP, and apitell checkapitell.com/mcpapitell.com/tuneThe spec is versioned by its text and by $schema. Amendments inside v1 live in CHANGELOG.md; the repository carries no release tags.