@xano/developer-mcp 1.0.26 → 1.0.27

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 (75) hide show
  1. package/dist/xanoscript_docs/README.md +78 -64
  2. package/dist/xanoscript_docs/apis.md +81 -27
  3. package/dist/xanoscript_docs/branch.md +13 -13
  4. package/dist/xanoscript_docs/database.md +57 -17
  5. package/dist/xanoscript_docs/functions.md +43 -71
  6. package/dist/xanoscript_docs/performance.md +14 -23
  7. package/dist/xanoscript_docs/tables.md +47 -1
  8. package/dist/xanoscript_docs/tools.md +9 -7
  9. package/dist/xanoscript_docs/types.md +12 -10
  10. package/package.json +1 -1
  11. package/dist/api_docs/format.d.ts +0 -5
  12. package/dist/api_docs/format.js +0 -171
  13. package/dist/api_docs/index.d.ts +0 -52
  14. package/dist/api_docs/index.js +0 -111
  15. package/dist/api_docs/topics/agent.d.ts +0 -2
  16. package/dist/api_docs/topics/agent.js +0 -142
  17. package/dist/api_docs/topics/api.d.ts +0 -2
  18. package/dist/api_docs/topics/api.js +0 -176
  19. package/dist/api_docs/topics/apigroup.d.ts +0 -2
  20. package/dist/api_docs/topics/apigroup.js +0 -124
  21. package/dist/api_docs/topics/authentication.d.ts +0 -2
  22. package/dist/api_docs/topics/authentication.js +0 -61
  23. package/dist/api_docs/topics/branch.d.ts +0 -2
  24. package/dist/api_docs/topics/branch.js +0 -73
  25. package/dist/api_docs/topics/file.d.ts +0 -2
  26. package/dist/api_docs/topics/file.js +0 -70
  27. package/dist/api_docs/topics/function.d.ts +0 -2
  28. package/dist/api_docs/topics/function.js +0 -164
  29. package/dist/api_docs/topics/history.d.ts +0 -2
  30. package/dist/api_docs/topics/history.js +0 -149
  31. package/dist/api_docs/topics/mcp_server.d.ts +0 -2
  32. package/dist/api_docs/topics/mcp_server.js +0 -139
  33. package/dist/api_docs/topics/middleware.d.ts +0 -2
  34. package/dist/api_docs/topics/middleware.js +0 -156
  35. package/dist/api_docs/topics/realtime.d.ts +0 -2
  36. package/dist/api_docs/topics/realtime.js +0 -112
  37. package/dist/api_docs/topics/start.d.ts +0 -2
  38. package/dist/api_docs/topics/start.js +0 -107
  39. package/dist/api_docs/topics/table.d.ts +0 -2
  40. package/dist/api_docs/topics/table.js +0 -195
  41. package/dist/api_docs/topics/task.d.ts +0 -2
  42. package/dist/api_docs/topics/task.js +0 -165
  43. package/dist/api_docs/topics/tool.d.ts +0 -2
  44. package/dist/api_docs/topics/tool.js +0 -150
  45. package/dist/api_docs/topics/workflows.d.ts +0 -2
  46. package/dist/api_docs/topics/workflows.js +0 -131
  47. package/dist/api_docs/topics/workspace.d.ts +0 -2
  48. package/dist/api_docs/topics/workspace.js +0 -153
  49. package/dist/api_docs/types.d.ts +0 -79
  50. package/dist/api_docs/types.js +0 -4
  51. package/dist/templates/init-workspace.d.ts +0 -10
  52. package/dist/templates/init-workspace.js +0 -278
  53. package/dist/templates/xanoscript-index.d.ts +0 -11
  54. package/dist/templates/xanoscript-index.js +0 -72
  55. package/dist/xanoscript_docs/ephemeral.md +0 -330
  56. package/dist/xanoscript_docs_auto/README.md +0 -119
  57. package/dist/xanoscript_docs_auto/agents.md +0 -446
  58. package/dist/xanoscript_docs_auto/apis.md +0 -517
  59. package/dist/xanoscript_docs_auto/control-flow.md +0 -543
  60. package/dist/xanoscript_docs_auto/database.md +0 -551
  61. package/dist/xanoscript_docs_auto/debugging.md +0 -527
  62. package/dist/xanoscript_docs_auto/filters.md +0 -464
  63. package/dist/xanoscript_docs_auto/functions.md +0 -431
  64. package/dist/xanoscript_docs_auto/integrations.md +0 -657
  65. package/dist/xanoscript_docs_auto/mcp-servers.md +0 -408
  66. package/dist/xanoscript_docs_auto/operators.md +0 -368
  67. package/dist/xanoscript_docs_auto/syntax.md +0 -287
  68. package/dist/xanoscript_docs_auto/tables.md +0 -447
  69. package/dist/xanoscript_docs_auto/tasks.md +0 -479
  70. package/dist/xanoscript_docs_auto/testing.md +0 -574
  71. package/dist/xanoscript_docs_auto/tools.md +0 -485
  72. package/dist/xanoscript_docs_auto/triggers.md +0 -595
  73. package/dist/xanoscript_docs_auto/types.md +0 -323
  74. package/dist/xanoscript_docs_auto/variables.md +0 -462
  75. package/dist/xanoscript_docs_auto/version.json +0 -5
@@ -1,164 +0,0 @@
1
- export const functionDoc = {
2
- topic: "function",
3
- title: "Reusable Function Management",
4
- description: `Functions are reusable pieces of logic that can be called from APIs, tasks, other functions, or anywhere in your Xano workspace.
5
-
6
- ## Key Concepts
7
- - Functions encapsulate reusable business logic
8
- - Can be called from APIs, tasks, other functions, agents, tools
9
- - Support input parameters and return values
10
- - Can be cached for performance
11
- - Support draft/publish workflow
12
-
13
- ## Caching Options
14
- Functions can cache results based on:
15
- - TTL (time-to-live)
16
- - Input parameters
17
- - Authenticated user
18
- - Datasource
19
- - IP address
20
- - Headers
21
- - Environment variables`,
22
- ai_hints: `- Functions are reusable across APIs and tasks
23
- - Use \`include_xanoscript=true\` to see implementation
24
- - Draft changes won't affect production until published
25
- - Caching can significantly improve performance for expensive operations
26
- - Check existing functions before creating duplicates`,
27
- endpoints: [
28
- {
29
- method: "GET",
30
- path: "/workspace/{workspace_id}/function",
31
- tool_name: "listFunctions",
32
- description: "List all functions in a workspace.",
33
- parameters: [
34
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
35
- { name: "page", type: "integer", default: 1, description: "Page number" },
36
- { name: "per_page", type: "integer", default: 50, description: "Items per page" },
37
- { name: "search", type: "string", description: "Search by function name" },
38
- { name: "sort", type: "string", enum: ["id", "name", "created_at"], default: "created_at", description: "Sort field" },
39
- { name: "order", type: "string", enum: ["asc", "desc"], default: "desc", description: "Sort direction" },
40
- { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code" },
41
- { name: "include_draft", type: "boolean", default: false, description: "Include draft versions" },
42
- { name: "branch", type: "string", description: "Filter by branch name" }
43
- ]
44
- },
45
- {
46
- method: "GET",
47
- path: "/workspace/{workspace_id}/function/{function_id}",
48
- tool_name: "getFunction",
49
- description: "Get details of a specific function.",
50
- parameters: [
51
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
52
- { name: "function_id", type: "integer", required: true, in: "path", description: "Function ID" },
53
- { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code" },
54
- { name: "include_draft", type: "boolean", default: false, description: "Include draft version" }
55
- ]
56
- },
57
- {
58
- method: "POST",
59
- path: "/workspace/{workspace_id}/function",
60
- tool_name: "createFunction",
61
- description: "Create a new reusable function.",
62
- parameters: [
63
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
64
- ],
65
- request_body: {
66
- type: "application/json",
67
- properties: {
68
- name: { type: "string", description: "Function name", required: true },
69
- description: { type: "string", description: "Function description" },
70
- xanoscript: { type: "string", description: "XanoScript function definition", required: true }
71
- }
72
- },
73
- example: {
74
- method: "POST",
75
- path: "/workspace/1/function",
76
- body: {
77
- name: "calculate_total",
78
- description: "Calculate order total with tax",
79
- xanoscript: `function calculate_total {
80
- input {
81
- decimal subtotal
82
- decimal tax_rate = 0.08
83
- }
84
- stack {
85
- var $tax {
86
- value = $input.subtotal * $input.tax_rate
87
- }
88
- var $total {
89
- value = $input.subtotal + $tax
90
- }
91
- }
92
- response = $total
93
- }`
94
- }
95
- }
96
- },
97
- {
98
- method: "PUT",
99
- path: "/workspace/{workspace_id}/function/{function_id}",
100
- tool_name: "updateFunction",
101
- description: "Update an existing function.",
102
- parameters: [
103
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
104
- { name: "function_id", type: "integer", required: true, in: "path", description: "Function ID" },
105
- { name: "publish", type: "boolean", default: true, description: "Publish changes immediately (false saves as draft)" }
106
- ],
107
- request_body: {
108
- type: "application/json",
109
- properties: {
110
- name: { type: "string", description: "Function name" },
111
- description: { type: "string", description: "Function description" },
112
- xanoscript: { type: "string", description: "XanoScript function definition" }
113
- }
114
- }
115
- },
116
- {
117
- method: "DELETE",
118
- path: "/workspace/{workspace_id}/function/{function_id}",
119
- tool_name: "deleteFunction",
120
- description: "Delete a function. Ensure no other resources depend on it.",
121
- parameters: [
122
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
123
- { name: "function_id", type: "integer", required: true, in: "path", description: "Function ID" }
124
- ]
125
- },
126
- {
127
- method: "PUT",
128
- path: "/workspace/{workspace_id}/function/{function_id}/security",
129
- tool_name: "updateFunctionSecurity",
130
- description: "Update security settings for the function.",
131
- parameters: [
132
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
133
- { name: "function_id", type: "integer", required: true, in: "path", description: "Function ID" }
134
- ],
135
- request_body: {
136
- type: "application/json",
137
- properties: {
138
- guid: { type: "string", description: "Security group GUID" }
139
- }
140
- }
141
- }
142
- ],
143
- schemas: {
144
- Function: {
145
- type: "object",
146
- properties: {
147
- id: { type: "integer" },
148
- name: { type: "string" },
149
- description: { type: "string" },
150
- xanoscript: { type: "string", description: "Only included if include_xanoscript=true" },
151
- cache: {
152
- type: "object",
153
- properties: {
154
- enabled: { type: "boolean" },
155
- ttl: { type: "integer", description: "Cache TTL in seconds" }
156
- }
157
- },
158
- created_at: { type: "string", format: "date-time" },
159
- updated_at: { type: "string", format: "date-time" }
160
- }
161
- }
162
- },
163
- related_topics: ["api", "task", "tool"]
164
- };
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../types.js";
2
- export declare const historyDoc: TopicDoc;
@@ -1,149 +0,0 @@
1
- export const historyDoc = {
2
- topic: "history",
3
- title: "Request & Execution History",
4
- description: `History endpoints provide audit logs for API requests and background executions. Use for debugging, monitoring, and compliance.
5
-
6
- ## Available History Types
7
- - **Request History**: All API requests with timing and responses
8
- - **Function History**: Function execution logs
9
- - **Task History**: Scheduled task execution logs
10
- - **Middleware History**: Middleware execution logs
11
- - **Tool History**: Agent tool execution logs
12
- - **Trigger History**: Event trigger execution logs
13
-
14
- ## Common Use Cases
15
- - Debugging failed requests
16
- - Performance monitoring
17
- - Audit compliance
18
- - Error tracking
19
- - Usage analytics`,
20
- ai_hints: `- Use request history to debug API issues
21
- - Filter by status to find errors (4xx, 5xx)
22
- - Use branch filter to separate dev/prod logs
23
- - Include payload for full request/response data
24
- - History is limited to recent requests (not permanent storage)`,
25
- endpoints: [
26
- {
27
- method: "GET",
28
- path: "/workspace/{workspace_id}/request_history",
29
- tool_name: "getRequestHistory",
30
- description: "Get API request history with pagination.",
31
- parameters: [
32
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
33
- { name: "page", type: "integer", default: 1, description: "Page number" },
34
- { name: "per_page", type: "integer", default: 50, description: "Items per page (max 500)" },
35
- { name: "branch", type: "string", description: "Filter by branch name" },
36
- { name: "api_id", type: "integer", description: "Filter by API endpoint ID" },
37
- { name: "include_payload", type: "boolean", default: false, description: "Include request/response payloads" }
38
- ]
39
- },
40
- {
41
- method: "POST",
42
- path: "/workspace/{workspace_id}/request_history/search",
43
- tool_name: "searchRequestHistory",
44
- description: "Search request history with advanced filters.",
45
- parameters: [
46
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
47
- ],
48
- request_body: {
49
- type: "application/json",
50
- properties: {
51
- branch: { type: "string", description: "Filter by branch" },
52
- api_id: { type: "integer", description: "Filter by API ID" },
53
- status: { type: "array", description: "Filter by status codes (e.g., [200, 201])" },
54
- verb: { type: "array", description: "Filter by HTTP methods (e.g., ['GET', 'POST'])" },
55
- from_date: { type: "string", description: "Start date (ISO format)" },
56
- to_date: { type: "string", description: "End date (ISO format)" }
57
- }
58
- }
59
- },
60
- {
61
- method: "GET",
62
- path: "/workspace/{workspace_id}/function_history",
63
- tool_name: "getFunctionHistory",
64
- description: "Get function execution history.",
65
- parameters: [
66
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
67
- { name: "function_id", type: "integer", description: "Filter by function ID" },
68
- { name: "page", type: "integer", default: 1, description: "Page number" },
69
- { name: "per_page", type: "integer", default: 50, description: "Items per page" }
70
- ]
71
- },
72
- {
73
- method: "GET",
74
- path: "/workspace/{workspace_id}/task_history",
75
- tool_name: "getTaskHistory",
76
- description: "Get scheduled task execution history.",
77
- parameters: [
78
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
79
- { name: "task_id", type: "integer", description: "Filter by task ID" },
80
- { name: "page", type: "integer", default: 1, description: "Page number" },
81
- { name: "per_page", type: "integer", default: 50, description: "Items per page" }
82
- ]
83
- },
84
- {
85
- method: "GET",
86
- path: "/workspace/{workspace_id}/middleware_history",
87
- tool_name: "getMiddlewareHistory",
88
- description: "Get middleware execution history.",
89
- parameters: [
90
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
91
- { name: "middleware_id", type: "integer", description: "Filter by middleware ID" },
92
- { name: "page", type: "integer", default: 1, description: "Page number" },
93
- { name: "per_page", type: "integer", default: 50, description: "Items per page" }
94
- ]
95
- },
96
- {
97
- method: "GET",
98
- path: "/workspace/{workspace_id}/tool_history",
99
- tool_name: "getToolHistory",
100
- description: "Get agent tool execution history.",
101
- parameters: [
102
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
103
- { name: "tool_id", type: "integer", description: "Filter by tool ID" },
104
- { name: "page", type: "integer", default: 1, description: "Page number" },
105
- { name: "per_page", type: "integer", default: 50, description: "Items per page" }
106
- ]
107
- },
108
- {
109
- method: "GET",
110
- path: "/workspace/{workspace_id}/trigger_history",
111
- tool_name: "getTriggerHistory",
112
- description: "Get trigger execution history.",
113
- parameters: [
114
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
115
- { name: "page", type: "integer", default: 1, description: "Page number" },
116
- { name: "per_page", type: "integer", default: 50, description: "Items per page" }
117
- ]
118
- }
119
- ],
120
- schemas: {
121
- RequestHistoryItem: {
122
- type: "object",
123
- properties: {
124
- id: { type: "integer" },
125
- api_id: { type: "integer" },
126
- verb: { type: "string" },
127
- path: { type: "string" },
128
- status: { type: "integer" },
129
- duration_ms: { type: "integer" },
130
- branch: { type: "string" },
131
- request_payload: { type: "object", description: "Only if include_payload=true" },
132
- response_payload: { type: "object", description: "Only if include_payload=true" },
133
- created_at: { type: "string", format: "date-time" }
134
- }
135
- },
136
- ExecutionHistoryItem: {
137
- type: "object",
138
- properties: {
139
- id: { type: "integer" },
140
- resource_id: { type: "integer" },
141
- status: { type: "string", enum: ["success", "error"] },
142
- duration_ms: { type: "integer" },
143
- error: { type: "string" },
144
- created_at: { type: "string", format: "date-time" }
145
- }
146
- }
147
- },
148
- related_topics: ["api", "function", "task"]
149
- };
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../types.js";
2
- export declare const mcpServerDoc: TopicDoc;
@@ -1,139 +0,0 @@
1
- export const mcpServerDoc = {
2
- topic: "mcp_server",
3
- title: "MCP Server Management",
4
- description: `MCP (Model Context Protocol) Servers expose tools to external AI clients like Claude Desktop, Cursor, or other MCP-compatible applications.
5
-
6
- ## Key Concepts
7
- - MCP Servers expose Xano tools via the MCP protocol
8
- - External AI clients can discover and call these tools
9
- - Supports authentication for secure access
10
- - Can have triggers for event-driven invocation
11
- - Standardized interface for AI tool discovery
12
-
13
- ## Use Cases
14
- - Expose Xano functionality to Claude Desktop
15
- - Integrate with AI IDEs like Cursor
16
- - Build custom AI assistants with Xano backend
17
- - Provide tools to any MCP-compatible client`,
18
- ai_hints: `- MCP Servers expose existing tools to external clients
19
- - Create tools first, then create MCP server to expose them
20
- - Authentication settings control who can access the server
21
- - Use triggers to invoke actions when MCP events occur
22
- - Check documentation endpoint for client setup instructions`,
23
- endpoints: [
24
- {
25
- method: "GET",
26
- path: "/workspace/{workspace_id}/mcp_server",
27
- tool_name: "listMcpServers",
28
- description: "List all MCP servers in a workspace.",
29
- parameters: [
30
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
31
- { name: "page", type: "integer", default: 1, description: "Page number" },
32
- { name: "per_page", type: "integer", default: 50, description: "Items per page" },
33
- { name: "search", type: "string", description: "Search by name" },
34
- { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript definition" }
35
- ]
36
- },
37
- {
38
- method: "GET",
39
- path: "/workspace/{workspace_id}/mcp_server/{mcp_server_id}",
40
- tool_name: "getMcpServer",
41
- description: "Get details of a specific MCP server.",
42
- parameters: [
43
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
44
- { name: "mcp_server_id", type: "integer", required: true, in: "path", description: "MCP Server ID" },
45
- { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript definition" }
46
- ]
47
- },
48
- {
49
- method: "POST",
50
- path: "/workspace/{workspace_id}/mcp_server",
51
- tool_name: "createMcpServer",
52
- description: "Create a new MCP server to expose tools.",
53
- parameters: [
54
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
55
- ],
56
- request_body: {
57
- type: "application/json",
58
- properties: {
59
- name: { type: "string", description: "MCP server name", required: true },
60
- description: { type: "string", description: "MCP server description" },
61
- xanoscript: { type: "string", description: "XanoScript MCP server definition", required: true }
62
- }
63
- },
64
- example: {
65
- method: "POST",
66
- path: "/workspace/1/mcp_server",
67
- body: {
68
- name: "my_tools",
69
- description: "MCP server exposing customer support tools",
70
- xanoscript: `mcp_server my_tools {
71
- tools = [lookup_order, update_ticket, send_notification]
72
- authentication {
73
- type = "bearer"
74
- token = env.MCP_TOKEN
75
- }
76
- }`
77
- }
78
- }
79
- },
80
- {
81
- method: "PUT",
82
- path: "/workspace/{workspace_id}/mcp_server/{mcp_server_id}",
83
- tool_name: "updateMcpServer",
84
- description: "Update an existing MCP server.",
85
- parameters: [
86
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
87
- { name: "mcp_server_id", type: "integer", required: true, in: "path", description: "MCP Server ID" }
88
- ],
89
- request_body: {
90
- type: "application/json",
91
- properties: {
92
- name: { type: "string", description: "MCP server name" },
93
- description: { type: "string", description: "MCP server description" },
94
- xanoscript: { type: "string", description: "XanoScript MCP server definition" }
95
- }
96
- }
97
- },
98
- {
99
- method: "DELETE",
100
- path: "/workspace/{workspace_id}/mcp_server/{mcp_server_id}",
101
- tool_name: "deleteMcpServer",
102
- description: "Delete an MCP server.",
103
- parameters: [
104
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
105
- { name: "mcp_server_id", type: "integer", required: true, in: "path", description: "MCP Server ID" }
106
- ]
107
- },
108
- {
109
- method: "GET",
110
- path: "/mcp_server/documentation",
111
- tool_name: "getMcpDocumentation",
112
- description: "Get MCP documentation for setup and syntax reference.",
113
- parameters: [
114
- { name: "type", type: "string", enum: ["start", "api", "function", "task", "mcp", "agent", "tool", "fs-syntax", "table", "database"], description: "Documentation type to retrieve" }
115
- ]
116
- }
117
- ],
118
- schemas: {
119
- McpServer: {
120
- type: "object",
121
- properties: {
122
- id: { type: "integer" },
123
- name: { type: "string" },
124
- description: { type: "string" },
125
- tools: { type: "array", items: { type: "string" } },
126
- authentication: {
127
- type: "object",
128
- properties: {
129
- type: { type: "string", enum: ["none", "bearer", "basic"] },
130
- token: { type: "string" }
131
- }
132
- },
133
- created_at: { type: "string", format: "date-time" },
134
- updated_at: { type: "string", format: "date-time" }
135
- }
136
- }
137
- },
138
- related_topics: ["tool", "agent", "authentication"]
139
- };
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../types.js";
2
- export declare const middlewareDoc: TopicDoc;
@@ -1,156 +0,0 @@
1
- export const middlewareDoc = {
2
- topic: "middleware",
3
- title: "Middleware Management",
4
- description: `Middleware are request/response interceptors that run before or after API endpoints. They handle cross-cutting concerns like authentication, logging, rate limiting, and request transformation.
5
-
6
- ## Key Concepts
7
- - Middleware runs before (pre) or after (post) API endpoints
8
- - Can modify requests, responses, or halt execution
9
- - Used for: auth validation, logging, rate limiting, CORS, etc.
10
- - Can be applied to specific endpoints or entire API groups
11
- - Support draft/publish workflow
12
-
13
- ## Common Middleware Patterns
14
- - Authentication/authorization checks
15
- - Request logging and timing
16
- - Rate limiting
17
- - Request/response transformation
18
- - CORS handling
19
- - Input validation`,
20
- ai_hints: `- Middleware runs on every matching request - keep it fast
21
- - Pre-middleware can halt execution (auth checks)
22
- - Post-middleware can transform responses
23
- - Check existing middleware before creating duplicates
24
- - Security settings control which endpoints use the middleware`,
25
- endpoints: [
26
- {
27
- method: "GET",
28
- path: "/workspace/{workspace_id}/middleware",
29
- tool_name: "listMiddlewares",
30
- description: "List all middleware in a workspace.",
31
- parameters: [
32
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
33
- { name: "page", type: "integer", default: 1, description: "Page number" },
34
- { name: "per_page", type: "integer", default: 50, description: "Items per page" },
35
- { name: "search", type: "string", description: "Search by name" },
36
- { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code" },
37
- { name: "include_draft", type: "boolean", default: false, description: "Include draft versions" }
38
- ]
39
- },
40
- {
41
- method: "GET",
42
- path: "/workspace/{workspace_id}/middleware/{middleware_id}",
43
- tool_name: "getMiddleware",
44
- description: "Get details of a specific middleware.",
45
- parameters: [
46
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
47
- { name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" },
48
- { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript code" },
49
- { name: "include_draft", type: "boolean", default: false, description: "Include draft version" }
50
- ]
51
- },
52
- {
53
- method: "POST",
54
- path: "/workspace/{workspace_id}/middleware",
55
- tool_name: "createMiddleware",
56
- description: "Create a new middleware.",
57
- parameters: [
58
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
59
- ],
60
- request_body: {
61
- type: "application/json",
62
- properties: {
63
- name: { type: "string", description: "Middleware name", required: true },
64
- description: { type: "string", description: "Middleware description" },
65
- type: { type: "string", description: "pre or post", required: true },
66
- xanoscript: { type: "string", description: "XanoScript middleware definition", required: true }
67
- }
68
- },
69
- example: {
70
- method: "POST",
71
- path: "/workspace/1/middleware",
72
- body: {
73
- name: "rate_limiter",
74
- description: "Limit requests to 100 per minute per IP",
75
- type: "pre",
76
- xanoscript: `middleware rate_limiter {
77
- stack {
78
- var $key {
79
- value = "ratelimit:" + $request.ip
80
- }
81
- var $count {
82
- value = redis.incr($key)
83
- }
84
- if ($count == 1) {
85
- redis.expire($key, 60)
86
- }
87
- if ($count > 100) {
88
- throw(429, "Rate limit exceeded")
89
- }
90
- }
91
- }`
92
- }
93
- }
94
- },
95
- {
96
- method: "PUT",
97
- path: "/workspace/{workspace_id}/middleware/{middleware_id}",
98
- tool_name: "updateMiddleware",
99
- description: "Update an existing middleware.",
100
- parameters: [
101
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
102
- { name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" },
103
- { name: "publish", type: "boolean", default: true, description: "Publish changes immediately" }
104
- ],
105
- request_body: {
106
- type: "application/json",
107
- properties: {
108
- name: { type: "string", description: "Middleware name" },
109
- description: { type: "string", description: "Middleware description" },
110
- xanoscript: { type: "string", description: "XanoScript middleware definition" }
111
- }
112
- }
113
- },
114
- {
115
- method: "DELETE",
116
- path: "/workspace/{workspace_id}/middleware/{middleware_id}",
117
- tool_name: "deleteMiddleware",
118
- description: "Delete a middleware.",
119
- parameters: [
120
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
121
- { name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" }
122
- ]
123
- },
124
- {
125
- method: "PUT",
126
- path: "/workspace/{workspace_id}/middleware/{middleware_id}/security",
127
- tool_name: "updateMiddlewareSecurity",
128
- description: "Update security settings for the middleware.",
129
- parameters: [
130
- { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
131
- { name: "middleware_id", type: "integer", required: true, in: "path", description: "Middleware ID" }
132
- ],
133
- request_body: {
134
- type: "application/json",
135
- properties: {
136
- guid: { type: "string", description: "Security group GUID" }
137
- }
138
- }
139
- }
140
- ],
141
- schemas: {
142
- Middleware: {
143
- type: "object",
144
- properties: {
145
- id: { type: "integer" },
146
- name: { type: "string" },
147
- description: { type: "string" },
148
- type: { type: "string", enum: ["pre", "post"] },
149
- xanoscript: { type: "string" },
150
- created_at: { type: "string", format: "date-time" },
151
- updated_at: { type: "string", format: "date-time" }
152
- }
153
- }
154
- },
155
- related_topics: ["api", "apigroup", "authentication"]
156
- };
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../types.js";
2
- export declare const realtimeDoc: TopicDoc;