Skills, tools & MCP
Three building blocks you attach to an agent. For ready-made examples, see the SAMPLES.md in the repo's docs/ folder.
| Block | What it is | How the agent uses it |
|---|---|---|
| Skill | Reusable instructions (tone, rules, domain knowledge), with optional reference, template and script files. | Per agent: Load when needed (the prompt lists it by name; the model loads it with a tool) or Always on (pasted into the system prompt). |
| Tool | An OpenAI-style function definition (name + description + JSON-Schema params). | Advertised to the model so it can request a call; your app executes it. |
| MCP server | A Model Context Protocol server discovered over JSON-RPC. | Its tools are advertised and executed by Relay's tool loop. |
Two more things an agent can call are documented on their own pages, because Relay executes them too: workflows attached as tools, and the read-only Microsoft 365 connector tools; a dataset agent's SQL tool is gateway-owned as well.
#Skills
A skill is shared prompt text — tone, formatting rules, house style, domain facts — that many agents reuse without duplicating it. Manage them under Skills; each skill has its own page with its name, a description for people, a When to use line, the instructions, its files and a What the model sees preview. The control-plane API is api/skills.
#Load when needed or Always on
Each skill attached to an agent has a mode, set in the agent's editor:
- Load when needed (the default for a newly attached skill). The system prompt carries only a short list: a fixed intro and one line per skill,
- refund-policy: <When to use>. When a question fits, the model callsrelay_load_skillwith the skill's short name and gets its full instructions plus a list of its files. If the instructions point to a file, it callsrelay_read_skill_filewith the skill and the file's path. A skill's text is added only to the run that loads it, so an agent with many skills keeps a small prompt. - Always on. The skill's instructions are pasted into the system prompt in full on every call, before the agent's own prompt — exactly how every skill worked before modes existed. Use it for rules that must apply to every answer, such as how to handle personal data.
Short names. The model calls a skill by a slug of its name (Refund policy → refund-policy). Two skills on one agent with the same slug get -2, -3 added in attachment order.
When to use. The model picks a skill only from its When to use line (at most 300 characters): say what the skill does, then when to use it. A skill with no line is left out of the list, so it can never be loaded; the agent editor warns about it and offers to switch it to Always on.
The two tools are offered only when an agent lists at least one skill. They run inside Relay and only ever read that agent's own attached skills (any other name is refused). A registry, MCP or workflow tool with one of these names fails the run with 409 tool_name_conflict. A loaded skill's instructions are cut at 60,000 characters and a file at 40,000, and the tool result says so when it cuts. A skill from the chat app always serves its approved version, never a newer draft.
Existing agents do not change. A skill with no stored mode is Always on, so every agent and every published version made before this works as it did. The agent editor shows a one-time notice on such agents, with a button to switch the skills that have a When to use line.
Streaming still works. An agent whose only tools are the two skill tools streams its answer when asked: each model call streams its text to you, and the skill calls in between run inside Relay. See Streaming vs. tool loop.
Voice. A realtime session has no skill tools, so it pastes every skill in full, whatever its mode.
#Files
A panel skill can hold up to 30 text files (.md, .txt, .csv, .tsv, .json, .yaml, .yml, .sql, .py), 1 MB each and 5 MB in all, each marked reference, template or script. A .py file is always a script. Add, replace and remove them on the skill's page, or through GET|POST|DELETE api/skills/{id}/files.
Relay never runs a script. A script is a file the agent can read with relay_read_skill_file, and the tool result says that Relay does not run it. The chat app still runs a user skill's scripts in its own sandbox.
#User skills (/v1/skills)
Apps can also let their own users make skills: the chat app's Settings › Skills page is one. Relay stores them; the app decides when a model loads one and runs any scripts itself. A user skill has a name, a when to use line (what the model reads to decide, at most 300 characters), Markdown instructions, and up to 30 text files: reference files (.md, .txt, .csv, .tsv, .json, .yaml, .sql) and Python scripts (.py), 1 MB each.
- Private first. A skill belongs to one user in one workspace. Only its owner sees or changes it.
- Shared by review. The owner can share it; an admin approves it, and then the approved version is in the workspace's company library. Others can add it to their own list or use it once. Editing an approved skill sends the new version back for review, and the library keeps serving the old one until then.
- Versions. Every save is a new version with its own copy of the files.
- Panel. Shared user skills (waiting or approved) appear on the Skills page here with their status, and Review… shows the instructions and every script in full. The panel cannot edit a user's skill, only approve, reject or remove it; its page shows it read-only, as agents get it. An approved user skill can be attached to an agent like any other skill, in either mode; the agent gets the approved version's name, When to use, instructions and files.
Every call needs a key that belongs to a workspace and the acting user in X-Relay-User-Id.
| Call | What it does |
|---|---|
GET /v1/skills?list=mine | The user's own skills and the library skills they added — what the app's model may pick from |
GET /v1/skills?list=library | The company library: approved user skills and enabled panel skills |
GET /v1/skills/{id}?version= | One skill with its instructions and files. Others always get the approved version |
POST /v1/skills · PUT /v1/skills/{id} · DELETE /v1/skills/{id} | Create, save a new version, delete (owner only) |
PUT /v1/skills/{id}/me | { "added": true } adds a library skill to the user's list; { "enabled": false } switches one off |
POST /v1/skills/{id}/share · POST /v1/skills/{id}/unshare | Ask for review (optional note); withdraw or take it out of the library |
POST /v1/skills/parse | { "fileName", "contentBase64" } of a SKILL.md or .zip in Claude's skill format → what it would create, and what was left out. Saves nothing |
GET /v1/skills/{id}/export | The skill as a Claude-format zip |
GET /v1/skills/reviews · GET /v1/skills/reviews/{id} · POST /v1/skills/{id}/review | The review queue and `{ "decision": "approve" \ |
Scopes. skills.use covers everything except review, which also needs skills.review. The user id is caller-asserted, so a key with skills.use can act as any user in its workspace: grant it only to apps that sign their own users in. The app must check that the user is an admin before calling the review endpoints; Relay records who it says decided. Every change is in the audit log.
#Tools
A tool is a function definition: a name, a description, and a JSON-Schema parameters object. Attaching a tool advertises it to the model.
Execution model — important:
- A registry tool with no backend of its own is only advertised. When the model calls it, Relay returns the
tool_callsto your app to execute, and the run ends there (your app sends the result back as atoolmessage on its next call). - A tool whose name is served by an attached MCP server, an attached workflow (
workflow_<slug>), a connector (microsoft_*) or a dataset (relay_run_dataset_sql) is executed by Relay automatically inside the agent's tool loop. A registry tool whose name collides with one of those fails the run with409 tool_name_conflict.
So: use MCP servers (or workflows) when you want Relay to run the tool; use registry tools when your app runs it. Read the registry with GET /v1/tools.
#The parameters schema
Paste the parameters object on its own — { "type": "object", "properties": { … }, "required": [ … ] } — not the whole function definition wrapped around it. Leave the field empty for a tool that takes no arguments.
Trailing commas and // comments are accepted and tidied away on save, since a schema is usually hand-written or lifted out of source. What gets stored is always strict JSON, because the gateway re-parses it with default options when it advertises the tool. Anything that cannot serve as a function's parameters is refused while you are still looking at the form — a top level that is not an object, a type other than "object", a non-object properties, or a required that is not a list of names — rather than by the provider partway through a conversation. Syntax errors are reported with the line and character, and typographic quotes (“ ”) pasted in from a document are called out by name, because the parser's own complaint about them is unrecognisable.
#MCP servers
Register a Model Context Protocol server by URL (HTTP/SSE JSON-RPC) with an optional bearer token, sent as Authorization: Bearer …. Click Discover tools to run tools/list and cache the server's tools for attachment. When such a server is attached to an agent, the agent run enters a tool loop: call the model → execute each requested MCP tool (tools/call, 20-second timeout) → feed results back → repeat, up to Gateway:ToolMaxIterations (default 5). A failed call never aborts the run: it comes back to the model as [tool error] … text it can react to. Dataset and connector agents use their own budgets (Gateway:Data:MaxIterations, 6; Gateway:Connectors:MaxIterations, 8).
The Tools count in the list is a link: click it to see what the server actually exposes — each tool's name and description, its arguments with type and required marker, and the raw inputSchema behind a disclosure. It reads the cached copy, so it shows what Relay will advertise to the model, which is only as fresh as the last discovery run.
Transport is HTTP/SSE — local
stdioMCP servers aren't reachable from a hosted gateway; front them with an HTTP/SSE bridge. Discovery sends a baretools/listwithout aninitializehandshake or session, so a server that insists on one fails discovery and shows sync error on the MCP page.
MCP bearer tokens are stored as entered, not encrypted — unlike provider keys, connector tokens and workflow credentials. MCP tools are also not executed in realtime sessions.
#Putting it together
A typical support agent: skills Refund policy and Store opening hours (Load when needed) and Guest data rules (Always on); tools get_order_status, create_support_ticket (your app executes them); MCP server Docs MCP (Relay executes it); workflow Escalate to Jira attached as a tool (Relay runs it). See the samples file for concrete definitions.