@xano/developer-mcp 2.2.2-beta.2 → 2.2.2-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,11 +12,12 @@ import { xanoscriptDocs, xanoscriptDocsTool, getXanoscriptDocsPath, setXanoscrip
12
12
  import { mcpVersion, mcpVersionTool, getServerVersion, setServerVersion, type McpVersionResult } from "./mcp_version.js";
13
13
  import { metaApiDocs, metaApiDocsTool, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult } from "./meta_api_docs.js";
14
14
  import { cliDocs, cliDocsTool, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult } from "./cli_docs.js";
15
+ import { xanoKnowledgeList, xanoKnowledgeListTool, xanoKnowledgeGet, xanoKnowledgeGetTool, type XanoKnowledgeListArgs, type XanoKnowledgeListResult, type XanoKnowledgeGetArgs, type XanoKnowledgeGetResult } from "./xano_knowledge.js";
15
16
  import { type ToolResult, toMcpResponse } from "./types.js";
16
17
  import { z } from "zod";
17
18
  import type { BuiltTool } from "./define_tool.js";
18
- export { validateXanoscript, TYPE_ALIASES, RESERVED_VARIABLES, type ValidateXanoscriptArgs, type ValidationResult, type BatchValidationResult, type SingleFileValidationResult, type ParserDiagnostic, xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, type TopicDoc, mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, type ToolResult, toMcpResponse, };
19
- export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, };
19
+ export { validateXanoscript, TYPE_ALIASES, RESERVED_VARIABLES, type ValidateXanoscriptArgs, type ValidationResult, type BatchValidationResult, type SingleFileValidationResult, type ParserDiagnostic, xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, type TopicDoc, mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, xanoKnowledgeList, xanoKnowledgeGet, type XanoKnowledgeListArgs, type XanoKnowledgeListResult, type XanoKnowledgeGetArgs, type XanoKnowledgeGetResult, type ToolResult, toMcpResponse, };
20
+ export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, xanoKnowledgeListTool, xanoKnowledgeGetTool, };
20
21
  /**
21
22
  * Full tool specs (Zod shapes + derived JSON Schema). Use these to register
22
23
  * tools with `McpServer.registerTool` — descriptions live in the shapes and
@@ -84,6 +85,36 @@ export declare const toolSpecs: {
84
85
  }, {
85
86
  documentation: z.ZodString;
86
87
  }>;
88
+ readonly xano_knowledge_list: BuiltTool<{
89
+ workspace: z.ZodOptional<z.ZodString>;
90
+ branch: z.ZodOptional<z.ZodString>;
91
+ type: z.ZodOptional<z.ZodEnum<{
92
+ "agents.md": "agents.md";
93
+ doc: "doc";
94
+ skill: "skill";
95
+ }>>;
96
+ enabled_only: z.ZodOptional<z.ZodBoolean>;
97
+ output: z.ZodOptional<z.ZodEnum<{
98
+ json: "json";
99
+ markdown: "markdown";
100
+ }>>;
101
+ profile: z.ZodOptional<z.ZodString>;
102
+ }, {
103
+ command: z.ZodString;
104
+ }>;
105
+ readonly xano_knowledge_get: BuiltTool<{
106
+ name: z.ZodString;
107
+ workspace: z.ZodOptional<z.ZodString>;
108
+ branch: z.ZodOptional<z.ZodString>;
109
+ file: z.ZodOptional<z.ZodString>;
110
+ output: z.ZodOptional<z.ZodEnum<{
111
+ json: "json";
112
+ text: "text";
113
+ }>>;
114
+ profile: z.ZodOptional<z.ZodString>;
115
+ }, {
116
+ command: z.ZodString;
117
+ }>;
87
118
  };
88
119
  export type ToolName = keyof typeof toolSpecs;
89
120
  /**
@@ -12,6 +12,7 @@ import { xanoscriptDocs, xanoscriptDocsTool, xanoscriptDocsToolSpec, getXanoscri
12
12
  import { mcpVersion, mcpVersionTool, mcpVersionToolSpec, getServerVersion, setServerVersion, } from "./mcp_version.js";
13
13
  import { metaApiDocs, metaApiDocsTool, metaApiDocsToolSpec, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, } from "./meta_api_docs.js";
14
14
  import { cliDocs, cliDocsTool, cliDocsToolSpec, cliTopics, getCliTopicNames, getCliTopicDescriptions, } from "./cli_docs.js";
15
+ import { xanoKnowledgeList, xanoKnowledgeListTool, xanoKnowledgeListToolSpec, xanoKnowledgeGet, xanoKnowledgeGetTool, xanoKnowledgeGetToolSpec, } from "./xano_knowledge.js";
15
16
  import { toMcpResponse } from "./types.js";
16
17
  // =============================================================================
17
18
  // Standalone Tool Functions (for library usage)
@@ -26,11 +27,13 @@ mcpVersion, getServerVersion, setServerVersion,
26
27
  // Meta API Documentation
27
28
  metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions,
28
29
  // CLI Documentation
29
- cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, toMcpResponse, };
30
+ cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions,
31
+ // Workspace Knowledge
32
+ xanoKnowledgeList, xanoKnowledgeGet, toMcpResponse, };
30
33
  // =============================================================================
31
34
  // Tool Result Functions (for internal MCP usage)
32
35
  // =============================================================================
33
- export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, };
36
+ export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, cliDocsTool, xanoKnowledgeListTool, xanoKnowledgeGetTool, };
34
37
  // =============================================================================
35
38
  // Tool Registry — single source of truth
36
39
  // =============================================================================
@@ -45,6 +48,8 @@ export const toolSpecs = {
45
48
  xano_version: mcpVersionToolSpec,
46
49
  xano_meta_api_docs: metaApiDocsToolSpec,
47
50
  xano_cli_docs: cliDocsToolSpec,
51
+ xano_knowledge_list: xanoKnowledgeListToolSpec,
52
+ xano_knowledge_get: xanoKnowledgeGetToolSpec,
48
53
  };
49
54
  /**
50
55
  * Tool definitions array (derived from toolSpecs). Kept for callers that
@@ -104,6 +109,18 @@ const dispatch = {
104
109
  return parsed.error;
105
110
  return cliDocsTool(parsed.data);
106
111
  },
112
+ async xano_knowledge_list(args) {
113
+ const parsed = parseWithSpec(xanoKnowledgeListToolSpec, args);
114
+ if (!parsed.ok)
115
+ return parsed.error;
116
+ return xanoKnowledgeListTool(parsed.data);
117
+ },
118
+ async xano_knowledge_get(args) {
119
+ const parsed = parseWithSpec(xanoKnowledgeGetToolSpec, args);
120
+ if (!parsed.ok)
121
+ return parsed.error;
122
+ return xanoKnowledgeGetTool(parsed.data);
123
+ },
107
124
  };
108
125
  function isToolName(name) {
109
126
  return name in dispatch;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Xano Workspace Knowledge Tools
3
+ *
4
+ * This MCP server has no shell access, so these tools don't run the CLI
5
+ * themselves — they return the exact `xano knowledge list` / `xano knowledge
6
+ * get` command to run, along with a short pointer on what it does.
7
+ */
8
+ import { z } from "zod";
9
+ import type { ToolResult } from "./types.js";
10
+ export interface XanoKnowledgeListArgs {
11
+ workspace?: string;
12
+ branch?: string;
13
+ type?: "skill" | "doc" | "agents.md";
14
+ enabled_only?: boolean;
15
+ output?: "markdown" | "json";
16
+ profile?: string;
17
+ }
18
+ export interface XanoKnowledgeGetArgs {
19
+ name: string;
20
+ workspace?: string;
21
+ branch?: string;
22
+ file?: string;
23
+ output?: "text" | "json";
24
+ profile?: string;
25
+ }
26
+ export interface XanoKnowledgeListResult {
27
+ command: string;
28
+ }
29
+ export interface XanoKnowledgeGetResult {
30
+ command: string;
31
+ }
32
+ export declare function xanoKnowledgeList(args: XanoKnowledgeListArgs): XanoKnowledgeListResult;
33
+ export declare function xanoKnowledgeGet(args: XanoKnowledgeGetArgs): XanoKnowledgeGetResult;
34
+ export declare function xanoKnowledgeListTool(args: XanoKnowledgeListArgs): ToolResult;
35
+ export declare function xanoKnowledgeGetTool(args: XanoKnowledgeGetArgs): ToolResult;
36
+ export declare const xanoKnowledgeListToolSpec: import("./define_tool.js").BuiltTool<{
37
+ workspace: z.ZodOptional<z.ZodString>;
38
+ branch: z.ZodOptional<z.ZodString>;
39
+ type: z.ZodOptional<z.ZodEnum<{
40
+ "agents.md": "agents.md";
41
+ doc: "doc";
42
+ skill: "skill";
43
+ }>>;
44
+ enabled_only: z.ZodOptional<z.ZodBoolean>;
45
+ output: z.ZodOptional<z.ZodEnum<{
46
+ json: "json";
47
+ markdown: "markdown";
48
+ }>>;
49
+ profile: z.ZodOptional<z.ZodString>;
50
+ }, {
51
+ command: z.ZodString;
52
+ }>;
53
+ export declare const xanoKnowledgeGetToolSpec: import("./define_tool.js").BuiltTool<{
54
+ name: z.ZodString;
55
+ workspace: z.ZodOptional<z.ZodString>;
56
+ branch: z.ZodOptional<z.ZodString>;
57
+ file: z.ZodOptional<z.ZodString>;
58
+ output: z.ZodOptional<z.ZodEnum<{
59
+ json: "json";
60
+ text: "text";
61
+ }>>;
62
+ profile: z.ZodOptional<z.ZodString>;
63
+ }, {
64
+ command: z.ZodString;
65
+ }>;
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Xano Workspace Knowledge Tools
3
+ *
4
+ * This MCP server has no shell access, so these tools don't run the CLI
5
+ * themselves — they return the exact `xano knowledge list` / `xano knowledge
6
+ * get` command to run, along with a short pointer on what it does.
7
+ */
8
+ import { z } from "zod";
9
+ import { defineTool } from "./define_tool.js";
10
+ // =============================================================================
11
+ // Command building
12
+ // =============================================================================
13
+ /** Quote an argv entry for display in a copy-pasteable shell command. */
14
+ function shellQuote(value) {
15
+ return /[^\w./-]/.test(value) ? `"${value.replace(/(["\\$`])/g, "\\$1")}"` : value;
16
+ }
17
+ function formatCommand(args) {
18
+ return args.map(shellQuote).join(" ");
19
+ }
20
+ export function xanoKnowledgeList(args) {
21
+ const cliArgs = ["xano", "knowledge", "list"];
22
+ if (args.workspace)
23
+ cliArgs.push("-w", args.workspace);
24
+ if (args.branch)
25
+ cliArgs.push("-b", args.branch);
26
+ if (args.type)
27
+ cliArgs.push("-t", args.type);
28
+ if (args.enabled_only === false)
29
+ cliArgs.push("--no-enabled-only");
30
+ cliArgs.push("-o", args.output ?? "markdown");
31
+ if (args.profile)
32
+ cliArgs.push("-p", args.profile);
33
+ return { command: formatCommand(cliArgs) };
34
+ }
35
+ export function xanoKnowledgeGet(args) {
36
+ const cliArgs = ["xano", "knowledge", "get", args.name];
37
+ if (args.workspace)
38
+ cliArgs.push("-w", args.workspace);
39
+ if (args.branch)
40
+ cliArgs.push("-b", args.branch);
41
+ if (args.file)
42
+ cliArgs.push("-f", args.file);
43
+ cliArgs.push("-o", args.output ?? "text");
44
+ if (args.profile)
45
+ cliArgs.push("-p", args.profile);
46
+ return { command: formatCommand(cliArgs) };
47
+ }
48
+ // =============================================================================
49
+ // Tool Result Functions (for internal MCP usage)
50
+ // =============================================================================
51
+ export function xanoKnowledgeListTool(args) {
52
+ const { command } = xanoKnowledgeList(args);
53
+ return {
54
+ success: true,
55
+ data: `Run this command to list the workspace's knowledge base (skills, docs, agents.md):\n\n${command}`,
56
+ structuredContent: { command },
57
+ };
58
+ }
59
+ export function xanoKnowledgeGetTool(args) {
60
+ if (!args?.name) {
61
+ return {
62
+ success: false,
63
+ error: "Error: 'name' parameter is required.",
64
+ };
65
+ }
66
+ const { command } = xanoKnowledgeGet(args);
67
+ return {
68
+ success: true,
69
+ data: `Run this command to fetch the knowledge item's content:\n\n${command}`,
70
+ structuredContent: { command },
71
+ };
72
+ }
73
+ // =============================================================================
74
+ // Tool Definitions (Zod shapes -> JSON Schema)
75
+ // =============================================================================
76
+ export const xanoKnowledgeListToolSpec = defineTool({
77
+ name: "xano_knowledge_list",
78
+ description: `Get the CLI command to list a Xano workspace's knowledge base: skills, docs, and the agents.md file. This tool does not run the command itself — it returns the exact \`xano knowledge list\` command to run in a shell, so you can invoke it and read its output.
79
+
80
+ Use this to get an overview of what knowledge/skills exist before answering questions about workspace conventions, or before deciding whether a new skill/doc needs to be created (to avoid duplicating existing ones).
81
+
82
+ Always-on items (mode=always) are returned by the command with full content; on-demand items are returned with just name+description — use xano_knowledge_get to get the command for fetching an on-demand item's full content when it becomes relevant.`,
83
+ annotations: {
84
+ readOnlyHint: true,
85
+ destructiveHint: false,
86
+ idempotentHint: true,
87
+ openWorldHint: false,
88
+ },
89
+ inputShape: {
90
+ workspace: z
91
+ .string()
92
+ .optional()
93
+ .describe("Workspace ID. Optional if the active profile has a default workspace configured."),
94
+ branch: z
95
+ .string()
96
+ .optional()
97
+ .describe("Branch ID to read knowledge from. Optional; defaults to the workspace's live branch."),
98
+ type: z
99
+ .enum(["skill", "doc", "agents.md"])
100
+ .optional()
101
+ .describe("Filter to a single knowledge type. Omit to list all types."),
102
+ enabled_only: z
103
+ .boolean()
104
+ .optional()
105
+ .describe("When true (default), only enabled items are returned. Set to false to include disabled items too."),
106
+ output: z
107
+ .enum(["markdown", "json"])
108
+ .optional()
109
+ .describe("markdown is human-readable (always-on items inline, on-demand items as a name+description index). " +
110
+ "json returns the full raw item array — prefer json when you need structured fields " +
111
+ "(id, guid, mode, references, etc.) for further processing. Default: markdown."),
112
+ profile: z
113
+ .string()
114
+ .optional()
115
+ .describe("CLI credential profile to use. Optional; falls back to XANO_PROFILE env var or the credentials file default."),
116
+ },
117
+ outputShape: {
118
+ command: z.string().describe("The `xano knowledge list` command to run to get the workspace's knowledge base."),
119
+ },
120
+ });
121
+ export const xanoKnowledgeGetToolSpec = defineTool({
122
+ name: "xano_knowledge_get",
123
+ description: `Get the CLI command to fetch the full content of one named knowledge item (a skill, doc, or agents.md), or one of a skill's attached reference files. This tool does not run the command itself — it returns the exact \`xano knowledge get\` command to run in a shell, so you can invoke it and read its output.
124
+
125
+ Use this after xano_knowledge_list has identified an on-demand item whose full content is now needed, or when a skill's step tells you to consult a specific reference file (via @filename syntax in the skill content).`,
126
+ annotations: {
127
+ readOnlyHint: true,
128
+ destructiveHint: false,
129
+ idempotentHint: true,
130
+ openWorldHint: false,
131
+ },
132
+ inputShape: {
133
+ name: z
134
+ .string()
135
+ .describe("The knowledge item's name (case-insensitive exact match). Required."),
136
+ workspace: z
137
+ .string()
138
+ .optional()
139
+ .describe("Workspace ID. Optional if the active profile has a default workspace configured."),
140
+ branch: z
141
+ .string()
142
+ .optional()
143
+ .describe("Branch ID. Optional; defaults to the workspace's live branch."),
144
+ file: z
145
+ .string()
146
+ .optional()
147
+ .describe("Path of a reference file attached to the item (as listed in that item's `references` array from " +
148
+ "xano_knowledge_list), fetched instead of the item's own content."),
149
+ output: z
150
+ .enum(["text", "json"])
151
+ .optional()
152
+ .describe("text returns the raw markdown content. json wraps it with metadata (item: full object; " +
153
+ "file: {content, name, path}). Default: text."),
154
+ profile: z
155
+ .string()
156
+ .optional()
157
+ .describe("CLI credential profile to use."),
158
+ },
159
+ outputShape: {
160
+ command: z.string().describe("The `xano knowledge get` command to run to fetch the knowledge item's content."),
161
+ },
162
+ });
@@ -125,12 +125,6 @@
125
125
  "priority": 3,
126
126
  "aliases": ["mcp", "model-context-protocol"]
127
127
  },
128
- "knowledge": {
129
- "file": "knowledge.md",
130
- "description": "Agent Knowledge: Skills, Docs, and AGENTS.md Context that steer the Xano AI agent (disclosure modes, scopes, authoring)",
131
- "applyTo": [],
132
- "aliases": ["skills", "skill", "docs", "agent-knowledge", "agents-md", "context"]
133
- },
134
128
  "unit-testing": {
135
129
  "file": "unit-testing.md",
136
130
  "description": "Unit tests, mocks, and assertions within functions, APIs, and middleware",
@@ -4,91 +4,52 @@ applyTo: "middleware/*.xs"
4
4
 
5
5
  # Middleware
6
6
 
7
- > **TL;DR:** Declare a middleware once (`middleware <name> { … }`), then attach it
8
- > with a `middleware = { pre: [...], post: [...] }` block on a **query/API**, a
9
- > **function**, or an **API group**. One middleware object serves both phases;
10
- > branch on `$input.type` (`"pre"` | `"post"`). Its `input` block is fixed to
11
- > `vars` + `type` — custom parameters are stripped.
12
-
13
- Middleware intercepts requests before (`pre`) and after (`post`) your queries,
14
- functions, tasks, and tools run. You define the middleware in one place and attach
15
- it to the constructs that should use it.
7
+ Middleware intercepts and processes requests before and after your functions, queries, tasks, and tools execute.
16
8
 
17
9
  ## Quick Reference
18
10
 
19
11
  ```xs
20
- // 1. Declare the middleware (the input block is fixed — see Input Contract)
21
- middleware add_metadata {
22
- input {
23
- json vars
24
- enum type {
25
- values = ["pre", "post"]
26
- }
27
- }
28
-
29
- stack {
30
- conditional {
31
- if ($input.type == "post") {
32
- // post-phase work
33
- }
34
- else {
35
- // pre-phase work
36
- }
37
- }
38
- }
39
-
40
- response = { server_time: now }
41
- response_strategy = "merge"
42
- exception_policy = "silent"
43
- }
44
- ```
45
-
46
- ```xs
47
- // 2. Attach it — reference the middleware by name
48
- query list_items verb=GET {
49
- api_group = "catalog"
50
-
51
- stack {
52
- db.query "items" { } as $items
53
- }
54
-
55
- response = $items
56
- middleware = {
57
- pre : [{name: "rate_limit"}]
58
- post: [{name: "add_metadata"}]
59
- }
12
+ middleware "<name>" {
13
+ description = "What this middleware does"
14
+ exception_policy = "silent" | "rethrow" | "critical"
15
+ response_strategy = "merge" | "replace"
16
+ input { ... }
17
+ stack { ... }
18
+ response = $result
60
19
  }
61
20
  ```
62
21
 
63
- | Piece | Purpose |
22
+ ### Required Blocks
23
+ | Block | Purpose |
64
24
  |-------|---------|
65
- | `middleware <name> { … }` | The reusable definition |
66
- | `input { json vars; enum type { … } }` | Fixed system inputs (see Input Contract) |
67
- | `response_strategy` | `merge` (default) or `replace` — how the middleware response combines |
68
- | `exception_policy` | `silent` (default), `rethrow`, or `critical` |
69
- | `middleware = { pre: [...], post: [...] }` | Attaches middleware to a construct or group by name |
25
+ | `input` | Define parameters passed to middleware |
26
+ | `stack` | Processing logic |
27
+ | `response` | Output returned to caller |
28
+
29
+ ### Optional Attributes
30
+ | Attribute | Values | Default | Description |
31
+ |-----------|--------|---------|-------------|
32
+ | `description` | text | - | Documents middleware purpose |
33
+ | `exception_policy` | `silent`, `rethrow`, `critical` | `rethrow` | How to handle errors |
34
+ | `response_strategy` | `merge`, `replace` | `merge` | How response combines with original |
70
35
 
71
36
  ---
72
37
 
73
- ## Declaring a Middleware
38
+ ## Basic Structure
74
39
 
75
40
  ```xs
76
- middleware log_request {
41
+ middleware "log_request" {
77
42
  description = "Logs all incoming requests"
78
43
 
79
44
  input {
80
- json vars
81
- enum type {
82
- values = ["pre", "post"]
83
- }
45
+ json request_data
84
46
  }
85
47
 
86
48
  stack {
87
- var $timestamp { value = now }
88
49
  debug.log {
89
50
  value = {
90
- timestamp: $timestamp,
91
- data: $input.vars
51
+ timestamp: now,
52
+ data: $input.request_data
92
53
  }
93
54
  }
94
55
  }
@@ -97,237 +58,70 @@ middleware log_request {
97
58
  }
98
59
  ```
99
60
 
100
- ### Required Blocks
101
- | Block | Required | Purpose |
102
- |-------|----------|---------|
103
- | `input` | Yes | Fixed system inputs (`vars`, `type`) — see Input Contract |
104
- | `stack` | Yes | Processing logic |
105
- | `response` | No | Output returned to the caller (omit it freely) |
106
-
107
- Omitting `input` or `stack` is a syntax error. Omitting `response` is fine.
108
-
109
- ### Optional Attributes
110
- | Attribute | Values | Default | Description |
111
- |-----------|--------|---------|-------------|
112
- | `description` | text | - | Documents the middleware (stored as a leading comment) |
113
- | `exception_policy` | `silent`, `rethrow`, `critical` | `silent` | How errors are handled |
114
- | `response_strategy` | `merge`, `replace` | `merge` | How the middleware response combines with the original |
115
-
116
- Values outside the listed enums are rejected (`Input "…" is not one of the allowable values.`).
117
-
118
- > The quoted name (`middleware "<name>"`) parses, but the canonical form is
119
- > unquoted: `middleware <name> { … }`. There is **no** `type` attribute on the
120
- > declaration — `type = "post"` fails with `Invalid block: type`. Which phase a
121
- > middleware runs in is decided where you attach it, not here.
122
-
123
- ---
124
-
125
- ## Input Contract (footgun)
126
-
127
- A middleware's `input` block is **fixed**. It is always normalised to exactly two
128
- system inputs, and **any custom parameters you add are silently discarded on push**:
129
-
130
- ```xs
131
- // ❌ These custom params are stripped — $input.token / $input.user_id become null
132
- input {
133
- text token
134
- int user_id
135
- }
136
-
137
- // ✅ The only inputs that survive — this is what every middleware receives
138
- input {
139
- json vars // request (pre) or response (post) payload context
140
- enum type { // which phase this invocation is running in
141
- values = ["pre", "post"]
142
- }
143
- }
144
- ```
145
-
146
- Read middleware data through `$input.vars` and branch on `$input.type` — never
147
- through named custom parameters.
148
-
149
- ### Pre vs Post phases
150
-
151
- There is **one middleware object per name, and it serves both phases**. The same
152
- `stack` runs for the pre and the post invocation; `$input.type` (`"pre"` |
153
- `"post"`) tells you which one you are in. Branch on it to do pre-work vs post-work
154
- in a single middleware:
155
-
156
- ```xs
157
- stack {
158
- conditional {
159
- if ($input.type == "pre") {
160
- // runs BEFORE the endpoint — inspect $input.vars (the request);
161
- // short-circuit with a precondition to block the request.
162
- }
163
- else {
164
- // runs AFTER the endpoint — $input.vars carries the response;
165
- // transform or augment it (combined per response_strategy).
166
- }
167
- }
168
- }
169
- ```
170
-
171
- ---
172
-
173
- ## Attaching Middleware
174
-
175
- A middleware does nothing until it is **attached**. Attach it with a `middleware`
176
- block that lists middleware by name for the `pre` and/or `post` phase:
177
-
178
- ```xs
179
- middleware = {
180
- pre : [{name: "rate_limit"}]
181
- post: [{name: "add_metadata"}]
182
- }
183
- ```
184
-
185
- Both lists are optional and independent — supply only the phase you need. A list
186
- can hold more than one middleware, and they run in the order written:
187
-
188
- ```xs
189
- middleware = {
190
- pre: [{name: "rate_limit"}, {name: "auth_check"}]
191
- }
192
- ```
193
-
194
- You can attach middleware at three scopes:
195
-
196
- ### On a query / API endpoint (per-endpoint)
197
-
198
- ```xs
199
- query create_order verb=POST {
200
- api_group = "orders"
201
-
202
- input {
203
- json order
204
- }
205
-
206
- stack {
207
- db.add "orders" { data = $input.order } as $new
208
- }
209
-
210
- response = $new
211
- middleware = {
212
- pre : [{name: "rate_limit"}]
213
- post: [{name: "add_metadata"}]
214
- }
215
- }
216
- ```
217
-
218
- ### On a function (function-stack)
219
-
220
- ```xs
221
- function process_payment {
222
- input {
223
- decimal amount
224
- }
225
-
226
- stack {
227
- var $result { value = { charged: $input.amount } }
228
- }
229
-
230
- response = $result
231
- middleware = {
232
- post: [{name: "audit_log"}]
233
- }
234
- }
235
- ```
236
-
237
- ### On an API group (applies to the whole group)
238
-
239
- Attach a `middleware` block to the `api_group` declaration to run it for every
240
- endpoint in that group:
241
-
242
- ```xs
243
- api_group orders {
244
- canonical = "orders_grp"
245
- middleware = {
246
- pre : [{name: "rate_limit"}]
247
- post: [{name: "add_metadata"}]
248
- }
249
- }
250
- ```
251
-
252
- > **Workspace-wide (global) middleware is configured in the Xano dashboard.** The
253
- > `middleware` block is only valid on queries, functions, and API groups — placing
254
- > it on the `workspace` declaration fails with `Invalid block: middleware`. To run
255
- > a middleware across the whole workspace, attach it from the dashboard's
256
- > middleware settings.
257
-
258
- > ⚠️ **Middleware names must match exactly.** A name that doesn't resolve to an
259
- > existing middleware is silently blanked (`{name: ""}`) on push, and the endpoint
260
- > then runs with no middleware — no error at push or request time. Double-check the
261
- > spelling against the middleware's declared name.
262
-
263
61
  ---
264
62
 
265
63
  ## Exception Policies
266
64
 
267
- Control how errors thrown inside the middleware are handled.
65
+ Control how middleware handles errors:
268
66
 
269
- ### silent (default)
270
- Errors are caught and ignored; execution continues.
67
+ ### silent
68
+ Errors are caught and ignored. Execution continues normally.
271
69
 
272
70
  ```xs
273
- middleware optional_enrichment {
71
+ middleware "optional_enrichment" {
274
72
  exception_policy = "silent"
275
73
 
276
74
  input {
277
- json vars
278
- enum type { values = ["pre", "post"] }
75
+ int user_id
279
76
  }
280
77
 
281
78
  stack {
282
- // If this fails, the request continues without enrichment
283
- api.request {
284
- url = "https://api.example.com/enrich"
285
- method = "GET"
79
+ // If this fails, request continues without enrichment
80
+ api.call "external_service" {
81
+ url = "https://api.example.com/enrich/" ~ $input.user_id
286
82
  } as $enriched
287
83
  }
288
84
 
289
- response = { enrichment: $enriched }
85
+ response = $enriched
290
86
  }
291
87
  ```
292
88
 
293
- ### rethrow
294
- Errors are passed through to the caller; standard error handling applies.
89
+ ### rethrow (default)
90
+ Errors are passed through to the caller. Standard error handling applies.
295
91
 
296
92
  ```xs
297
- middleware validate_token {
93
+ middleware "validate_token" {
298
94
  exception_policy = "rethrow"
299
95
 
300
96
  input {
301
- json vars
302
- enum type { values = ["pre", "post"] }
97
+ text token
303
98
  }
304
99
 
305
100
  stack {
306
- precondition (($input.vars|get:"token"|strlen) > 0) {
101
+ precondition ($input.token|strlen > 0) {
307
102
  error_type = "accessdenied"
308
103
  error = "Token required"
309
104
  }
310
105
  }
311
106
 
312
- response = null
107
+ response = { valid: true }
313
108
  }
314
109
  ```
315
110
 
316
111
  ### critical
317
- Errors are treated as critical failures and terminate the request immediately.
112
+ Errors are treated as critical failures. Request is immediately terminated.
318
113
 
319
114
  ```xs
320
- middleware security_check {
115
+ middleware "security_check" {
321
116
  exception_policy = "critical"
322
117
 
323
118
  input {
324
- json vars
325
- enum type { values = ["pre", "post"] }
119
+ text ip_address
326
120
  }
327
121
 
328
122
  stack {
329
123
  db.query "blocked_ips" {
330
- where = $db.blocked_ips.ip == $env.$remote_ip
124
+ where = $db.blocked_ips.ip == $input.ip_address
331
125
  return = { type: "exists" }
332
126
  } as $is_blocked
333
127
 
@@ -337,7 +131,7 @@ middleware security_check {
337
131
  }
338
132
  }
339
133
 
340
- response = null
134
+ response = { allowed: true }
341
135
  }
342
136
  ```
343
137
 
@@ -345,68 +139,54 @@ middleware security_check {
345
139
 
346
140
  ## Response Strategies
347
141
 
348
- Control how the middleware's `response` combines with the endpoint's response.
349
- This applies to the **post** phase, where `$input.vars` carries the response.
142
+ Control how middleware response combines with the original response:
350
143
 
351
144
  ### merge (default)
352
- The middleware response is merged into the original response.
145
+ Middleware response is merged with original response.
353
146
 
354
147
  ```xs
355
- middleware add_metadata {
148
+ middleware "add_metadata" {
356
149
  response_strategy = "merge"
357
150
 
358
151
  input {
359
- json vars
360
- enum type { values = ["pre", "post"] }
361
152
  }
362
153
 
363
154
  stack {
364
- var $server_time { value = now }
365
- }
366
-
367
- response = {
368
- _meta: {
369
- server_time: $server_time,
370
- version: "1.0.0"
155
+ var $meta {
156
+ value = {
157
+ server_time: now,
158
+ version: "1.0.0"
159
+ }
371
160
  }
372
161
  }
162
+
163
+ response = { _meta: $meta }
373
164
  }
374
165
  // Original: { data: [...] }
375
- // Result: { data: [...], _meta: { server_time: ..., version: "1.0.0" } }
166
+ // Result: { data: [...], _meta: { server_time: ..., version: "1.0.0" } }
376
167
  ```
377
168
 
378
- > ⚠️ **`now` only evaluates as a direct value.** Bare `now` returns the current
379
- > timestamp when it is the whole value of a `var` or a top-level entry of the
380
- > `response` object. Nested **inside** a `response` object literal (e.g. under
381
- > `_meta`) it is emitted as the literal string `"now"`. Compute it into a `var`
382
- > first and reference that var:
383
- > ```xs
384
- > stack { var $server_time { value = now } }
385
- > response = { _meta: { server_time: $server_time } } // ✅ real timestamp
386
- > ```
387
-
388
169
  ### replace
389
- The middleware response completely replaces the original response.
170
+ Middleware response completely replaces original response.
390
171
 
391
172
  ```xs
392
- middleware wrap_response {
173
+ middleware "transform_response" {
393
174
  response_strategy = "replace"
394
175
 
395
176
  input {
396
- json vars
397
- enum type { values = ["pre", "post"] }
177
+ json original_response
398
178
  }
399
179
 
400
180
  stack {
401
- var $wrapped {
181
+ var $transformed {
402
182
  value = {
403
183
  success: true,
404
- payload: $input.vars
184
+ payload: $input.original_response
405
185
  }
406
186
  }
407
187
  }
408
188
 
409
- response = $wrapped
189
+ response = $transformed
410
190
  }
411
191
  ```
412
192
 
@@ -414,153 +194,116 @@ middleware wrap_response {
414
194
 
415
195
  ## Common Patterns
416
196
 
417
- Every middleware receives the same two inputs (`vars`, `type`). Read request or
418
- response data from `$input.vars` and use `$input.type` to act only in the phase you
419
- want.
420
-
421
- ### Audit logging (post)
197
+ ### Request Logging
422
198
 
423
199
  ```xs
424
- middleware audit_log {
425
- description = "Logs requests for an audit trail"
200
+ middleware "audit_log" {
201
+ description = "Logs all API requests for audit trail"
426
202
  exception_policy = "silent"
427
203
 
428
204
  input {
429
- json vars
430
- enum type { values = ["pre", "post"] }
205
+ text endpoint
206
+ text method
207
+ json request_body?
208
+ int user_id?
431
209
  }
432
210
 
433
211
  stack {
434
- conditional {
435
- if ($input.type == "post") {
436
- db.add "audit_log" {
437
- data = {
438
- context: $input.vars,
439
- ip_address: $env.$remote_ip,
440
- created_at: now
441
- }
442
- }
212
+ db.add "audit_log" {
213
+ data = {
214
+ endpoint: $input.endpoint,
215
+ method: $input.method,
216
+ request_body: $input.request_body,
217
+ user_id: $input.user_id,
218
+ ip_address: $env.$remote_ip,
219
+ created_at: now
443
220
  }
444
221
  }
445
222
  }
223
+
224
+ response = null
446
225
  }
447
226
  ```
448
227
 
449
- ### Rate limiting (pre)
228
+ ### Rate Limiting
450
229
 
451
230
  ```xs
452
- middleware rate_limit {
453
- description = "Limits requests per client IP"
231
+ middleware "rate_limit" {
232
+ description = "Enforces rate limits per user"
233
+ exception_policy = "rethrow"
454
234
 
455
235
  input {
456
- json vars
457
- enum type { values = ["pre", "post"] }
236
+ int user_id
237
+ int max_requests?=100
238
+ int window_seconds?=60
458
239
  }
459
240
 
460
241
  stack {
461
- conditional {
462
- if ($input.type == "pre") {
463
- redis.ratelimit {
464
- key = "ratelimit:" ~ $env.$remote_ip
465
- max = 100
466
- ttl = 60
467
- error = "Rate limit exceeded"
468
- }
469
- }
242
+ redis.ratelimit {
243
+ key = "ratelimit:" ~ $input.user_id
244
+ max = $input.max_requests
245
+ ttl = $input.window_seconds
246
+ error = "Rate limit exceeded"
470
247
  }
471
248
  }
249
+
250
+ response = null
472
251
  }
473
252
  ```
474
253
 
475
- ### Response caching (post)
254
+ ### Response Caching
476
255
 
477
256
  ```xs
478
- middleware cache_response {
257
+ middleware "cache_response" {
479
258
  description = "Caches responses in Redis"
480
259
  exception_policy = "silent"
481
260
 
482
261
  input {
483
- json vars
484
- enum type { values = ["pre", "post"] }
262
+ text cache_key
263
+ int ttl_seconds?=300
264
+ json response_data
485
265
  }
486
266
 
487
267
  stack {
488
- conditional {
489
- if ($input.type == "post") {
490
- redis.set {
491
- key = "cache:" ~ ($input.vars|json_encode)
492
- data = $input.vars
493
- ttl = 300
494
- }
495
- }
268
+ redis.set {
269
+ key = $input.cache_key
270
+ value = $input.response_data|json_encode
271
+ expire = $input.ttl_seconds
496
272
  }
497
273
  }
274
+
275
+ response = null
498
276
  }
499
277
  ```
500
278
 
501
279
  ---
502
280
 
503
- ## Common Mistakes
281
+ ## Applying Middleware
504
282
 
505
- ❌ **Adding custom inputs to a middleware:**
506
- ```xs
507
- input {
508
- text token // stripped on push — $input.token is null at runtime
509
- }
510
- ```
511
- ✅ **Read from the fixed `vars` input:**
512
- ```xs
513
- input {
514
- json vars
515
- enum type { values = ["pre", "post"] }
516
- }
517
- // ... reference $input.vars, e.g. ($input.vars|get:"token")
518
- ```
283
+ Middleware is configured at the branch level. See `xano_xanoscript_docs({ topic: "branch" })` for configuration details.
519
284
 
520
- ❌ **Expecting a `type` attribute to pick the phase:**
521
- ```xs
522
- middleware log_request {
523
- type = "post" // Invalid block: type
524
- ...
525
- }
526
- ```
527
- ✅ **One object serves both phases — branch on `$input.type`:**
528
285
  ```xs
529
- stack {
530
- conditional {
531
- if ($input.type == "post") { /* ... */ }
286
+ branch "production" {
287
+ middleware = {
288
+ query: {
289
+ pre: ["validate_token", "rate_limit"],
290
+ post: ["audit_log", "cache_response"]
291
+ },
292
+ function: {
293
+ pre: ["validate_token"],
294
+ post: ["audit_log"]
295
+ }
532
296
  }
533
297
  }
534
298
  ```
535
299
 
536
- ❌ **Misspelling the attached name:**
537
- ```xs
538
- middleware = { pre: [{name: "rate_limitr"}] } // silently becomes {name: ""} — no middleware runs
539
- ```
540
- ✅ **Match the declared middleware name exactly:**
541
- ```xs
542
- middleware = { pre: [{name: "rate_limit"}] }
543
- ```
544
-
545
- ❌ **Putting a middleware block on the workspace declaration:**
546
- ```xs
547
- workspace "my-app" {
548
- middleware = { pre: [...] } // Invalid block: middleware
549
- }
550
- ```
551
- ✅ **Attach on a query, function, or API group — or configure workspace-wide
552
- middleware in the dashboard.**
553
-
554
300
  ---
555
301
 
556
302
  ## Best Practices
557
303
 
558
- 1. **Keep middleware focused** — each one should do a single thing well.
559
- 2. **Choose the exception policy deliberately** — `critical` for security gates,
560
- `silent` for optional enrichment.
561
- 3. **Attach at the right scope** — per-endpoint for targeted logic, on the API
562
- group for cross-cutting concerns shared by every endpoint in the group.
563
- 4. **Mind performance** — middleware runs on every matching request.
304
+ 1. **Keep middleware focused** - Each middleware should do one thing well
305
+ 2. **Use appropriate exception policies** - Critical for security, silent for optional enrichment
306
+ 3. **Consider performance** - Middleware runs on every request; log even silent failures
564
307
 
565
308
  ---
566
309
 
@@ -568,7 +311,7 @@ middleware in the dashboard.**
568
311
 
569
312
  | Topic | Description |
570
313
  |-------|-------------|
571
- | `apis` | API endpoint request/response lifecycle |
572
- | `functions` | Reusable function stacks |
314
+ | `branch` | Branch-level middleware configuration |
573
315
  | `security` | Authentication and authorization patterns |
574
- | `integrations/redis` | Rate limiting and caching primitives |
316
+ | `apis` | API endpoint request/response lifecycle |
317
+ | `performance` | Performance optimization strategies |
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "2.5.0",
3
- "updated": "2026-07-02"
2
+ "version": "2.4.0",
3
+ "updated": "2026-06-10"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/developer-mcp",
3
- "version": "2.2.2-beta.2",
3
+ "version": "2.2.2-beta.6",
4
4
  "description": "MCP server and library for Xano development - XanoScript validation, Meta API, Run API, and CLI documentation",
5
5
  "type": "module",
6
6
  "main": "dist/lib.js",
@@ -1,146 +0,0 @@
1
- ---
2
- applyTo: []
3
- ---
4
-
5
- # Skills & Docs (Agent Knowledge)
6
-
7
- Teach the Xano AI agent how to work in your workspace — standing rules, reference docs, and repeatable procedures it follows when building your backend.
8
-
9
- > **TL;DR:** Agent Knowledge has three kinds of files. **Context** (`AGENTS.md`) is always loaded — standing rules for every run. A **Doc** is a single markdown file the agent reads for reference when a task calls for it. A **Skill** is a folder (`SKILL.md` + optional reference files) the agent follows step by step. Control *when* each loads with a disclosure mode, and *who* sees it with a scope.
10
-
11
- ---
12
-
13
- ## Quick Reference
14
-
15
- | Type | Lives at | Best for | Loading |
16
- |------|----------|----------|---------|
17
- | **Context** | `AGENTS.md` | Standing rules & conventions the agent must always know | Always, in full |
18
- | **Doc** | `docs/<name>.md` | Facts, specs, guidelines the agent reads on demand | On demand |
19
- | **Skill** | `skills/<name>/SKILL.md` | Repeatable, multi-step procedures | On demand or manual |
20
- | **Reference** | a file inside a skill | Supporting detail a skill step needs | Pulled in by its skill |
21
-
22
- **Disclosure** (when it loads): `Always included` · `On demand` · `Manual`
23
- **Scope** (who sees it): `Workspace` (everyone) · `Private` (only you)
24
-
25
- ---
26
-
27
- ## The three knowledge types
28
-
29
- ### Context — your `AGENTS.md`
30
-
31
- A single `AGENTS.md` file that is **injected into every agent session, in full**. It's the right home for the conventions, rules, and patterns you want the agent to repeat on every run: the backend's purpose, the data model's shape, naming conventions, the auth model, standard error shapes.
32
-
33
- Because every line is loaded on every run, every line has a permanent context cost — so keep it lean. Capture the *shape* and the *non-obvious*; let the agent drill into specifics with its own tools when it needs them.
34
-
35
- ```markdown
36
- # Acme Orders API
37
-
38
- > Backend for the Acme storefront — handles auth, catalog, and checkout.
39
-
40
- ## Data model
41
- | Table | Purpose | Key fields / relationships |
42
- | ------ | --------------- | ---------------------------- |
43
- | users | Auth + profile | id, email; has many `orders` |
44
- | orders | Customer orders | id, user_id → users, status |
45
-
46
- Orders are soft-deleted (`deleted_at`), never hard-deleted.
47
-
48
- ## Conventions
49
- - Auth: JWT in `Authorization: Bearer`. Protect every non-public endpoint.
50
- - Errors: return `{ error: { code, message } }`, never a bare string.
51
- ```
52
-
53
- > **Tip:** Use the **`init`** skill to scaffold `AGENTS.md` — it inspects your workspace (read-only) and works with you to capture purpose, data model, APIs, logic, and conventions, asking one question at a time rather than guessing.
54
-
55
- ### Doc — reference material
56
-
57
- A single markdown file at `docs/<name>.md` that the agent reads **when a task calls for it**. Best for facts, specs, and guidelines — a style guide, an external API's quirks, a domain glossary. The agent sees the title and description up front and pulls in the full file only when relevant, so docs don't spend context on every run.
58
-
59
- ### Skill — a repeatable procedure
60
-
61
- A folder at `skills/<name>/` containing a `SKILL.md` (and optional reference files) that the agent **follows step by step**. Best for multi-step workflows that recur — "scaffold a CRUD API for a table", "apply rate limiting to an endpoint", "add audit logging to a mutation".
62
-
63
- ```markdown
64
- ---
65
- name: rate-limit-endpoint
66
- description: Apply rate limiting to an endpoint. Use when a user asks to
67
- throttle, protect, or rate-limit an endpoint, or guard it from abuse.
68
- ---
69
-
70
- # Rate Limit an Endpoint
71
-
72
- Add a Rate Limit function to the start of an endpoint's stack so repeated
73
- calls from the same caller are rejected before they do work.
74
-
75
- ## Steps
76
- 1. Confirm which endpoint and the limit (requests per window) with the user.
77
- 2. Add a `precondition` that checks the caller's recent request count.
78
- 3. Return a 429 with a clear message when the limit is exceeded.
79
- ```
80
-
81
- > **Tip:** Use the **`create-skill`** skill to author one — it captures *what* the agent should do, *when* it should trigger, and *what good looks like*, then writes a well-formed `SKILL.md`.
82
-
83
- ---
84
-
85
- ## Disclosure — controlling when knowledge loads
86
-
87
- Each doc and skill has a disclosure mode that decides how it enters the agent's context:
88
-
89
- | Mode | What loads | Use when |
90
- |------|-----------|----------|
91
- | **Always included** | The full file, every run | Rules the agent must never miss. Use sparingly — it spends context on every run. |
92
- | **On demand** | Only the title + description up front; the agent pulls the full file when it judges it relevant | The default. Reference material and most skills. |
93
- | **Manual** | Nothing automatically; loads only when you name it in the prompt | Niche or expensive procedures you want to invoke deliberately. |
94
-
95
- `AGENTS.md` is always *Always included* — that's the whole point of Context. Reserve *Always included* on docs and skills for the rare thing the agent genuinely must read every time.
96
-
97
- ---
98
-
99
- ## Scope — controlling who sees it
100
-
101
- | Scope | Who | Use for |
102
- |-------|-----|---------|
103
- | **Workspace** | Everyone in the workspace | Shared conventions, team procedures, project docs |
104
- | **Private** | Only you | Personal helpers and drafts you're still refining |
105
-
106
- ---
107
-
108
- ## Writing knowledge the agent actually follows
109
-
110
- The same principles run through good Context, Docs, and Skills:
111
-
112
- - **Write a description that earns its place.** For docs and skills, the description is the *only* text always loaded — it's what the agent uses to decide whether to pull in the rest. Be explicit and specific: name the exact situations and phrases that should trigger it. A vague description means the file never gets used (or gets used at the wrong time).
113
- - **Explain *why*, not just *what*.** Rigid commands ("ALWAYS do X") are brittle — the agent can't adapt when a situation differs slightly. Give the reasoning instead, so it applies the rule correctly in cases you didn't foresee. Weak: "Validate input before saving." Better: "Validate input before saving — bad records are far harder to find and fix once they're in your live tables."
114
- - **Keep it lean.** Every line costs context the agent could spend reasoning. Cut preamble, ceremony, and anything the agent already knows.
115
- - **Put rules in `AGENTS.md`, procedures in skills.** Workspace-wide conventions (naming, auth, error shapes) belong in `AGENTS.md`, which is always loaded. A skill is for a repeatable *workflow* — it should *assume* those conventions and use them, not restate them.
116
- - **Generalize past the example.** A skill is usually born from one concrete request. Write the general pattern, not the one case, so it helps with the whole class of tasks.
117
- - **Add a guardrail before anything hard to reverse.** Have a skill confirm with the user before a destructive change (deleting a table, dropping an endpoint).
118
-
119
- ---
120
-
121
- ## Common Mistakes
122
-
123
- ❌ **Putting a one-off task in a skill.** Skills are for workflows that recur. A single task is faster to just ask for.
124
- ✅ Create a skill only when the same multi-step workflow comes up again and again.
125
-
126
- ❌ **Restating `AGENTS.md` conventions inside a skill.** Duplicated instructions drift out of sync and bloat the body.
127
- ✅ Assume `AGENTS.md` is loaded; reference its conventions and use them.
128
-
129
- ❌ **Stuffing reference material into `AGENTS.md` to "make sure the agent has it".** It then pays that cost on every run.
130
- ✅ Put reference material in a **Doc** (on demand). Reserve `AGENTS.md` for rules that apply every time.
131
-
132
- ❌ **A vague skill description** ("helps with endpoints").
133
- ✅ A pushy, specific one that names the trigger: "Apply rate limiting to an endpoint. Use when a user asks to throttle or protect an endpoint from abuse."
134
-
135
- ❌ **Marking many skills "Always included".**
136
- ✅ Default to **On demand**; reserve *Always included* for the rare thing the agent must read every time.
137
-
138
- ---
139
-
140
- ## Related Topics
141
-
142
- | Topic | Description |
143
- |-------|-------------|
144
- | `agents` | XanoScript `agent` construct — LLM providers and tools |
145
- | `tools` | Functions an agent can execute |
146
- | `workspace` | Workspace-level settings and preferences |