@xano/developer-mcp 1.0.1 → 1.0.2

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.
Files changed (42) hide show
  1. package/README.md +96 -31
  2. package/dist/index.js +248 -180
  3. package/package.json +4 -2
  4. package/xanoscript_docs/README.md +107 -1
  5. package/xanoscript_docs/agents.md +329 -0
  6. package/xanoscript_docs/apis.md +343 -0
  7. package/xanoscript_docs/database.md +417 -0
  8. package/xanoscript_docs/ephemeral.md +333 -0
  9. package/xanoscript_docs/frontend.md +291 -0
  10. package/xanoscript_docs/functions.md +232 -2035
  11. package/xanoscript_docs/integrations.md +439 -0
  12. package/xanoscript_docs/mcp-servers.md +190 -0
  13. package/xanoscript_docs/plan.md +192 -0
  14. package/xanoscript_docs/syntax.md +314 -0
  15. package/xanoscript_docs/tables.md +270 -0
  16. package/xanoscript_docs/tasks.md +254 -0
  17. package/xanoscript_docs/testing.md +335 -0
  18. package/xanoscript_docs/tools.md +305 -0
  19. package/xanoscript_docs/types.md +297 -0
  20. package/xanoscript_docs/version.json +2 -1
  21. package/xanoscript_docs/api_query_examples.md +0 -1255
  22. package/xanoscript_docs/api_query_guideline.md +0 -129
  23. package/xanoscript_docs/build_from_lovable.md +0 -715
  24. package/xanoscript_docs/db_query_guideline.md +0 -427
  25. package/xanoscript_docs/ephemeral_environment_guideline.md +0 -529
  26. package/xanoscript_docs/expression_guideline.md +0 -1086
  27. package/xanoscript_docs/frontend_guideline.md +0 -67
  28. package/xanoscript_docs/function_examples.md +0 -1406
  29. package/xanoscript_docs/function_guideline.md +0 -130
  30. package/xanoscript_docs/input_guideline.md +0 -227
  31. package/xanoscript_docs/mcp_server_examples.md +0 -36
  32. package/xanoscript_docs/mcp_server_guideline.md +0 -69
  33. package/xanoscript_docs/query_filter.md +0 -489
  34. package/xanoscript_docs/table_examples.md +0 -586
  35. package/xanoscript_docs/table_guideline.md +0 -137
  36. package/xanoscript_docs/task_examples.md +0 -511
  37. package/xanoscript_docs/task_guideline.md +0 -103
  38. package/xanoscript_docs/tips_and_tricks.md +0 -144
  39. package/xanoscript_docs/tool_examples.md +0 -69
  40. package/xanoscript_docs/tool_guideline.md +0 -139
  41. package/xanoscript_docs/unit_testing_guideline.md +0 -328
  42. package/xanoscript_docs/workspace.md +0 -17
@@ -1 +1,107 @@
1
- # xanoscript-ai-documentation
1
+ # XanoScript Documentation
2
+
3
+ XanoScript is the declarative scripting language for [Xano](https://xano.com), a no-code/low-code backend platform. Use it to define database schemas, API endpoints, functions, scheduled tasks, and AI agents.
4
+
5
+ ## Quick Reference
6
+
7
+ | Construct | File Location | Purpose |
8
+ |-----------|---------------|---------|
9
+ | `table` | `tables/*.xs` | Database schema definition |
10
+ | `function` | `functions/**/*.xs` | Reusable logic blocks |
11
+ | `query` | `apis/<group>/*.xs` | HTTP API endpoints |
12
+ | `task` | `tasks/*.xs` | Scheduled/cron jobs |
13
+ | `agent` | `agents/**/*.xs` | AI-powered agents |
14
+ | `tool` | `tools/**/*.xs` | Tools for AI agents |
15
+ | `mcp_server` | `mcp_servers/**/*.xs` | MCP server definitions |
16
+ | `addon` | `addons/*.xs` | Subqueries for related data |
17
+
18
+ ## Workspace Structure
19
+
20
+ ```
21
+ project/
22
+ ├── tables/ # Database table schemas
23
+ ├── functions/ # Reusable functions (supports subfolders)
24
+ ├── apis/
25
+ │ └── <api-group>/ # API endpoints grouped by domain
26
+ ├── tasks/ # Scheduled jobs
27
+ ├── agents/ # AI agents
28
+ ├── tools/ # AI tools
29
+ ├── mcp_servers/ # MCP server definitions
30
+ ├── addons/ # Query addons
31
+ ├── static/ # Frontend files (HTML, CSS, JS)
32
+ └── ephemeral/ # Temporary test environments
33
+ ```
34
+
35
+ ## Environment Variables
36
+
37
+ Access with `$env.<name>`. Built-in variables:
38
+
39
+ | Variable | Description |
40
+ |----------|-------------|
41
+ | `$env.$remote_ip` | Client IP address |
42
+ | `$env.$http_headers` | Request headers array |
43
+ | `$env.$request_uri` | Request URI |
44
+ | `$env.$request_method` | HTTP method (GET, POST, etc.) |
45
+ | `$env.$request_querystring` | Query string |
46
+ | `$env.$datasource` | Current datasource |
47
+ | `$env.$branch` | Current branch |
48
+
49
+ Custom environment variables are set in the Xano dashboard and accessed as `$env.MY_VAR`.
50
+
51
+ ## Core Syntax Patterns
52
+
53
+ ### Block Structure
54
+ ```xs
55
+ <construct> "<name>" {
56
+ input { ... } # Parameters (optional)
57
+ stack { ... } # Logic
58
+ response = $var # Output
59
+ }
60
+ ```
61
+
62
+ ### Variable Access
63
+ ```xs
64
+ $input.field # Input parameters
65
+ $var.field # Stack variables
66
+ $auth.id # Authenticated user ID
67
+ $env.MY_VAR # Environment variable
68
+ $db.table.field # Database field reference (in queries)
69
+ $this # Current item in loops/maps
70
+ ```
71
+
72
+ ### Filters (Pipe Syntax)
73
+ ```xs
74
+ $value|trim|lower # Chain filters
75
+ $input.name|strlen # Get length
76
+ $array|first # First element
77
+ ($a + $b)|round:2 # Math with precision
78
+ ```
79
+
80
+ ## File Frontmatter
81
+
82
+ Documentation files use frontmatter to specify which file patterns they apply to:
83
+
84
+ ```markdown
85
+ ---
86
+ applyTo: "functions/**/*.xs"
87
+ ---
88
+ ```
89
+
90
+ This helps AI tools apply the correct documentation based on the file being edited.
91
+
92
+ ## Documentation Index
93
+
94
+ 1. [Syntax Reference](syntax.md) - Expressions, operators, filters
95
+ 2. [Types & Inputs](types.md) - Data types, validation, input blocks
96
+ 3. [Tables](tables.md) - Database schema definitions
97
+ 4. [Functions](functions.md) - Reusable function stacks
98
+ 5. [APIs](apis.md) - HTTP endpoint definitions
99
+ 6. [Tasks](tasks.md) - Scheduled jobs
100
+ 7. [Database Operations](database.md) - Query, add, edit, delete
101
+ 8. [Agents](agents.md) - AI agent configuration
102
+ 9. [Tools](tools.md) - AI tools for agents
103
+ 10. [MCP Servers](mcp-servers.md) - Model Context Protocol servers
104
+ 11. [Testing](testing.md) - Unit tests and mocking
105
+ 12. [Integrations](integrations.md) - Cloud services, Redis, security
106
+ 13. [Frontend](frontend.md) - Static frontend development
107
+ 14. [Ephemeral](ephemeral.md) - Temporary environments
@@ -0,0 +1,329 @@
1
+ ---
2
+ applyTo: "agents/**/*.xs"
3
+ ---
4
+
5
+ # Agents
6
+
7
+ AI-powered agents that use LLMs to perform tasks autonomously.
8
+
9
+ ## Quick Reference
10
+
11
+ ```xs
12
+ agent "<name>" {
13
+ canonical = "<unique-id>"
14
+ description = "What this agent does"
15
+ llm = {
16
+ type: "<provider>"
17
+ system_prompt: "Agent instructions"
18
+ prompt: "{{ $args.message }}"
19
+ max_steps: 5
20
+ }
21
+ tools = [{ name: "<tool-name>" }]
22
+ }
23
+ ```
24
+
25
+ ### LLM Providers
26
+ | Provider | Type Value |
27
+ |----------|------------|
28
+ | Xano Free (Gemini) | `xano-free` |
29
+ | Google Gemini | `google-genai` |
30
+ | OpenAI | `openai` |
31
+ | Anthropic | `anthropic` |
32
+
33
+ ---
34
+
35
+ ## Basic Structure
36
+
37
+ ```xs
38
+ agent "Customer Support" {
39
+ canonical = "support-agent-v1"
40
+ description = "Handles customer inquiries"
41
+ llm = {
42
+ type: "xano-free"
43
+ system_prompt: "You are a helpful customer support agent."
44
+ prompt: "{{ $args.user_message }}"
45
+ max_steps: 5
46
+ temperature: 0.7
47
+ }
48
+ tools = [
49
+ { name: "get_order_status" },
50
+ { name: "create_ticket" }
51
+ ]
52
+ }
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Calling Agents
58
+
59
+ ```xs
60
+ ai.agent.run "Customer Support" {
61
+ args = {}|set:"user_message":$input.message
62
+ allow_tool_execution = true
63
+ } as $response
64
+ ```
65
+
66
+ ---
67
+
68
+ ## LLM Configuration
69
+
70
+ ### Common Properties
71
+
72
+ ```xs
73
+ llm = {
74
+ type: "<provider>" # Required
75
+ system_prompt: "..." # Agent persona and rules
76
+ prompt: "{{ $args.input }}" # User input template
77
+ max_steps: 5 # Max LLM calls per run
78
+ }
79
+ ```
80
+
81
+ ### Dynamic Variables
82
+ - `{{ $args.<name> }}` - Runtime arguments
83
+ - `{{ $env.<name> }}` - Environment variables (for API keys)
84
+
85
+ ---
86
+
87
+ ## Provider Configurations
88
+
89
+ ### Xano Free (for testing)
90
+ ```xs
91
+ llm = {
92
+ type: "xano-free"
93
+ system_prompt: "You are a helpful assistant."
94
+ prompt: "{{ $args.message }}"
95
+ max_steps: 3
96
+ temperature: 0
97
+ search_grounding: false # Google Search grounding
98
+ }
99
+ ```
100
+
101
+ ### Google Gemini
102
+ ```xs
103
+ llm = {
104
+ type: "google-genai"
105
+ api_key: "{{ $env.GEMINI_API_KEY }}"
106
+ model: "gemini-2.5-flash"
107
+ system_prompt: "You are a helpful assistant."
108
+ prompt: "{{ $args.message }}"
109
+ max_steps: 5
110
+ temperature: 0.2
111
+ thinking_tokens: 10000 # Extended thinking
112
+ include_thoughts: true
113
+ }
114
+ ```
115
+
116
+ ### OpenAI
117
+ ```xs
118
+ llm = {
119
+ type: "openai"
120
+ api_key: "{{ $env.OPENAI_API_KEY }}"
121
+ model: "gpt-5-mini"
122
+ system_prompt: "You are a helpful assistant."
123
+ prompt: "{{ $args.message }}"
124
+ max_steps: 5
125
+ temperature: 0.8
126
+ reasoning_effort: "medium" # low, medium, high
127
+ }
128
+ ```
129
+
130
+ **OpenAI-Compatible APIs:**
131
+ ```xs
132
+ llm = {
133
+ type: "openai"
134
+ api_key: "{{ $env.GROQ_API_KEY }}"
135
+ baseURL: "https://api.groq.com/openai/v1"
136
+ model: "llama-3.3-70b-versatile"
137
+ compatibility: "compatible" # Required for non-OpenAI
138
+ ...
139
+ }
140
+ ```
141
+
142
+ Supported: Groq, Mistral, OpenRouter, X.AI
143
+
144
+ ### Anthropic Claude
145
+ ```xs
146
+ llm = {
147
+ type: "anthropic"
148
+ api_key: "{{ $env.ANTHROPIC_API_KEY }}"
149
+ model: "claude-sonnet-4-5-20250929"
150
+ system_prompt: "You are a helpful assistant."
151
+ prompt: "{{ $args.message }}"
152
+ max_steps: 8
153
+ temperature: 0.3
154
+ send_reasoning: true # Include thinking blocks
155
+ }
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Structured Outputs
161
+
162
+ Force JSON response format (disables tools):
163
+
164
+ ```xs
165
+ agent "Classifier" {
166
+ canonical = "classifier-v1"
167
+ llm = {
168
+ type: "openai"
169
+ api_key: "{{ $env.OPENAI_API_KEY }}"
170
+ model: "gpt-5-mini"
171
+ system_prompt: "Classify the sentiment of the text."
172
+ prompt: "{{ $args.text }}"
173
+ structured_outputs: true
174
+
175
+ output {
176
+ enum sentiment { values = ["positive", "negative", "neutral"] }
177
+ decimal confidence filters=min:0|max:1
178
+ text reasoning?
179
+ }
180
+ }
181
+ tools = []
182
+ }
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Tools
188
+
189
+ Reference tools by name from `tools/` directory:
190
+
191
+ ```xs
192
+ tools = [
193
+ { name: "get_user_by_email" },
194
+ { name: "update_order_status" },
195
+ { name: "send_notification" }
196
+ ]
197
+ ```
198
+
199
+ **Important:** Do not describe tools in system_prompt or prompt. Tool descriptions are automatically provided to the LLM.
200
+
201
+ ---
202
+
203
+ ## Prompting
204
+
205
+ ### Using Twig Templates
206
+ ```xs
207
+ llm = {
208
+ prompt: """
209
+ User ID: {{ $args.user_id }}
210
+ Request: {{ $args.message }}
211
+
212
+ {% if $args.is_priority %}
213
+ This is a priority customer. Respond within 5 minutes.
214
+ {% endif %}
215
+ """
216
+ }
217
+ ```
218
+
219
+ ### Available Variables
220
+ ```xs
221
+ {{ $args.any_arg }} # Runtime arguments
222
+ {{ $env.MY_VAR }} # Environment variables
223
+ {{ "now"|date("Y-m-d") }} # Current date
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Complete Examples
229
+
230
+ ### Task Manager Agent
231
+ ```xs
232
+ agent "Task Manager" {
233
+ canonical = "task-mgr-v1"
234
+ description = "Manages user tasks"
235
+ llm = {
236
+ type: "google-genai"
237
+ api_key: "{{ $env.GEMINI_API_KEY }}"
238
+ model: "gemini-2.5-flash"
239
+ system_prompt: """
240
+ You help users manage their tasks. You can:
241
+ - Add new tasks
242
+ - Mark tasks complete
243
+ - List pending tasks
244
+ Always confirm actions with the user.
245
+ """
246
+ prompt: "User {{ $args.user_id }}: {{ $args.message }}"
247
+ max_steps: 5
248
+ temperature: 0.2
249
+ }
250
+ tools = [
251
+ { name: "add_task" },
252
+ { name: "complete_task" },
253
+ { name: "list_tasks" }
254
+ ]
255
+ }
256
+ ```
257
+
258
+ ### Code Review Agent
259
+ ```xs
260
+ agent "Code Reviewer" {
261
+ canonical = "code-review-v1"
262
+ llm = {
263
+ type: "anthropic"
264
+ api_key: "{{ $env.ANTHROPIC_API_KEY }}"
265
+ model: "claude-sonnet-4-5-20250929"
266
+ system_prompt: """
267
+ You are an expert code reviewer. Analyze code for:
268
+ - Bugs and potential issues
269
+ - Security vulnerabilities
270
+ - Performance problems
271
+ - Code style and best practices
272
+ Provide specific, actionable feedback.
273
+ """
274
+ prompt: """
275
+ Language: {{ $args.language }}
276
+ Code:
277
+ ```
278
+ {{ $args.code }}
279
+ ```
280
+ """
281
+ max_steps: 3
282
+ temperature: 0.1
283
+ send_reasoning: true
284
+ }
285
+ tools = []
286
+ }
287
+ ```
288
+
289
+ ### Multi-Tool Research Agent
290
+ ```xs
291
+ agent "Research Assistant" {
292
+ canonical = "research-v1"
293
+ llm = {
294
+ type: "openai"
295
+ api_key: "{{ $env.OPENAI_API_KEY }}"
296
+ model: "gpt-5"
297
+ system_prompt: """
298
+ You are a research assistant. Use your tools to:
299
+ 1. Search for relevant information
300
+ 2. Analyze data
301
+ 3. Compile findings into clear summaries
302
+ Always cite your sources.
303
+ """
304
+ prompt: "Research topic: {{ $args.topic }}"
305
+ max_steps: 10
306
+ temperature: 0.5
307
+ reasoning_effort: "high"
308
+ }
309
+ tools = [
310
+ { name: "web_search" },
311
+ { name: "fetch_article" },
312
+ { name: "analyze_data" },
313
+ { name: "save_findings" }
314
+ ]
315
+ }
316
+ ```
317
+
318
+ ---
319
+
320
+ ## Best Practices
321
+
322
+ 1. **Clear system prompts** - Define persona, capabilities, and constraints
323
+ 2. **Use appropriate temperature** - Low for factual, higher for creative
324
+ 3. **Limit max_steps** - Prevent infinite loops (3-10 typical)
325
+ 4. **Don't repeat tool descriptions** - They're auto-injected
326
+ 5. **Use environment variables** - Never hardcode API keys
327
+ 6. **Keep prompts focused** - One task per agent
328
+ 7. **Test with xano-free first** - Free for development
329
+ 8. **Use structured outputs** - When you need consistent JSON