@xano/xanoscript-language-server 11.5.0 → 11.6.1

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 (32) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/lexer/literal.js +1 -1
  3. package/onDidChangeContent/onDidChangeContent.js +4 -4
  4. package/onHover/onHoverDocument.js +3 -3
  5. package/onSemanticCheck/highlight.js +3 -3
  6. package/onSemanticCheck/onSemanticCheck.js +1 -1
  7. package/package.json +1 -1
  8. package/parser/agent_parser.js +7 -9
  9. package/parser/api_group_parser.js +10 -23
  10. package/parser/clauses/cacheClause.js +9 -10
  11. package/parser/functions/util/utilGetRawInputFn.js +1 -1
  12. package/parser/functions/util/utilGetRawInputFn.spec.js +7 -0
  13. package/parser/functions/varFn.js +39 -2
  14. package/parser/functions/varFn.spec.js +21 -0
  15. package/parser/generic/assignableVariableProperty.js +40 -3
  16. package/parser/generic/completeEnvVariable.js +1 -1
  17. package/parser/generic/completeEnvVariable.spec.js +5 -0
  18. package/parser/generic/expressionFn.spec.js +9 -4
  19. package/parser/generic/register.js +10 -22
  20. package/parser/mcp_server_parser.js +7 -9
  21. package/parser/mcp_server_trigger_parser.js +2 -6
  22. package/parser/realtime_trigger_parser.js +3 -7
  23. package/parser/table_trigger_parser.js +9 -11
  24. package/parser/test_parser.js +0 -4
  25. package/parser/workspace_trigger_parser.js +4 -8
  26. package/server.js +2 -2
  27. package/parser/generic/arrayOfObjectAttrReq.js +0 -47
  28. package/parser/generic/arrayOfObjectAttrReq.spec.js +0 -254
  29. package/parser/generic/arrayOfStringLiterals.js +0 -45
  30. package/parser/generic/arrayOfStringLiterals.spec.js +0 -56
  31. package/parser/generic/objectAttrReq.js +0 -243
  32. package/parser/generic/objectAttrReq.spec.js +0 -412
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm test:*)",
5
+ "Bash(node -e:*)",
6
+ "Bash(node --input-type=module -e:*)",
7
+ "Bash(git checkout:*)",
8
+ "Bash(ls:*)",
9
+ "Bash(npm run lint:*)"
10
+ ]
11
+ }
12
+ }
package/lexer/literal.js CHANGED
@@ -24,7 +24,7 @@ export const SingleQuotedStringLiteral = createUniqToken({
24
24
  export const FloatLiteral = createUniqToken({
25
25
  name: "FloatLiteral",
26
26
  label: "floating point number",
27
- pattern: /-?\d+\.\d+/,
27
+ pattern: /-?\d+\.\d+([eE][+-]?\d+)?/,
28
28
  });
29
29
 
30
30
  export const IntegerLiteral = createUniqToken({
@@ -62,7 +62,7 @@ export function onDidChangeContent(params, connection) {
62
62
  if (!document) {
63
63
  console.error(
64
64
  "onDidChangeContent(): Document not found for URI:",
65
- params.textDocument.uri
65
+ params.textDocument.uri,
66
66
  );
67
67
  return null;
68
68
  }
@@ -74,7 +74,7 @@ export function onDidChangeContent(params, connection) {
74
74
  const { parser, scheme } = documentCache.getOrParse(
75
75
  document.uri,
76
76
  document.version,
77
- text
77
+ text,
78
78
  );
79
79
 
80
80
  if (parser.errors.length === 0) {
@@ -84,7 +84,7 @@ export function onDidChangeContent(params, connection) {
84
84
 
85
85
  for (const error of parser.errors) {
86
86
  console.error(
87
- `onDidChangeContent(): Error parsing document: ${error.name}`
87
+ `onDidChangeContent(): Error parsing document: ${error.name}`,
88
88
  );
89
89
  }
90
90
 
@@ -93,7 +93,7 @@ export function onDidChangeContent(params, connection) {
93
93
 
94
94
  console.log(
95
95
  `onDidChangeContent(): sending diagnostic (${parser.errors.length} errors) for scheme:`,
96
- scheme
96
+ scheme,
97
97
  );
98
98
 
99
99
  connection.sendDiagnostics({
@@ -39,7 +39,7 @@ export function onHoverDocument(params, documents, hoverProviders = []) {
39
39
  if (!document) {
40
40
  console.error(
41
41
  "onHover(): Document not found for URI:",
42
- params.textDocument.uri
42
+ params.textDocument.uri,
43
43
  );
44
44
  return null;
45
45
  }
@@ -51,7 +51,7 @@ export function onHoverDocument(params, documents, hoverProviders = []) {
51
51
  const { lexResult, parser } = documentCache.getOrParse(
52
52
  params.textDocument.uri,
53
53
  document.version,
54
- text
54
+ text,
55
55
  );
56
56
 
57
57
  if (lexResult.errors.length > 0) return null;
@@ -67,7 +67,7 @@ export function onHoverDocument(params, documents, hoverProviders = []) {
67
67
 
68
68
  // Find the hover provider that matches the token
69
69
  const messageProvider = hoverProviders.find((provider) =>
70
- provider.isMatch(tokenIdx, tokens, parser)
70
+ provider.isMatch(tokenIdx, tokens, parser),
71
71
  );
72
72
 
73
73
  if (messageProvider) {
@@ -30,13 +30,13 @@ function higlightDefault(text, SemanticTokensBuilder) {
30
30
  character,
31
31
  token.image.length, // Length of the token
32
32
  encodeTokenType(tokenType), // Numeric ID for the token type
33
- 0 // No modifiers for now
33
+ 0, // No modifiers for now
34
34
  );
35
35
  } else if (tokenType === undefined) {
36
36
  console.log(
37
37
  `token type not mapped to a type: ${JSON.stringify(
38
- token.tokenType.name
39
- )}`
38
+ token.tokenType.name,
39
+ )}`,
40
40
  );
41
41
  }
42
42
  });
@@ -13,7 +13,7 @@ export function onSemanticCheck(params, documents, SemanticTokensBuilder) {
13
13
  if (!document) {
14
14
  console.error(
15
15
  "onSemanticCheck(): Document not found for URI:",
16
- params.textDocument.uri
16
+ params.textDocument.uri,
17
17
  );
18
18
  return null;
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/xanoscript-language-server",
3
- "version": "11.5.0",
3
+ "version": "11.6.1",
4
4
  "description": "Language Server Protocol implementation for XanoScript",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -250,18 +250,16 @@ export function agentDeclaration($) {
250
250
  $.CONSUME2(EqualToken); // "="
251
251
 
252
252
  // [{"name":"tool_name"}]
253
- $.SUBRULE($.arrayOfObjectAttrReq, {
253
+ $.SUBRULE($.schemaParseArrayFn, {
254
254
  ARGS: [
255
255
  subParent,
256
- ["name"], // required
257
- ["active", "auth"], // optional
258
- {
259
- types: {
260
- active: "boolean",
261
- auth: "string",
262
- name: "string",
256
+ [
257
+ {
258
+ name: "[string]",
259
+ "active?": "[boolean]",
260
+ "auth?": "[string]",
263
261
  },
264
- },
262
+ ],
265
263
  ],
266
264
  });
267
265
  },
@@ -59,27 +59,16 @@ export function apiGroupDeclaration($) {
59
59
 
60
60
  const subParent = $.CONSUME(CorsToken);
61
61
  $.CONSUME3(EqualToken); // "="
62
- $.SUBRULE($.objectAttrReq, {
62
+ $.SUBRULE($.schemaParseObjectFn, {
63
63
  ARGS: [
64
64
  subParent,
65
- [], // required
66
- [
67
- "mode",
68
- "origins",
69
- "methods",
70
- "headers",
71
- "credentials",
72
- "max_age",
73
- ], // optional
74
65
  {
75
- types: {
76
- mode: "string",
77
- origins: ($) => $.SUBRULE($.arrayOfStringLiterals),
78
- methods: ($) => $.SUBRULE1($.arrayOfStringLiterals),
79
- headers: ($) => $.SUBRULE2($.arrayOfStringLiterals),
80
- credentials: "boolean",
81
- max_age: "number",
82
- },
66
+ "mode?": "[string]",
67
+ "origins?": ["[string]"],
68
+ "methods?": ["[string]"],
69
+ "headers?": ["[string]"],
70
+ "credentials?": "[boolean]",
71
+ "max_age?": "[number]",
83
72
  },
84
73
  ],
85
74
  });
@@ -112,14 +101,12 @@ export function apiGroupDeclaration($) {
112
101
  hasSwagger = true;
113
102
  const subRule = $.CONSUME(SwaggerToken);
114
103
  $.CONSUME4(EqualToken); // "="
115
- $.SUBRULE2($.objectAttrReq, {
104
+ $.SUBRULE2($.schemaParseObjectFn, {
116
105
  ARGS: [
117
106
  subRule,
118
- [], // required
119
- ["active", "token"], // optional
120
107
  {
121
- active: "boolean",
122
- token: "string",
108
+ "active?": "[boolean]",
109
+ "token?": "[string]",
123
110
  },
124
111
  ],
125
112
  });
@@ -10,19 +10,18 @@ export function cacheClause($) {
10
10
  $.sectionStack.push("cacheClause");
11
11
  const parent = $.CONSUME(Cachetoken); // "cache"
12
12
  $.CONSUME(EqualToken); // "="
13
- $.SUBRULE($.objectAttrReq, {
13
+
14
+ $.SUBRULE($.schemaParseObjectFn, {
14
15
  ARGS: [
15
16
  parent,
16
- ["ttl", "input", "auth", "datasource", "ip"],
17
- ["headers", "env"],
18
17
  {
19
- types: {
20
- ttl: "number",
21
- input: "boolean",
22
- auth: "boolean",
23
- datasource: "boolean",
24
- ip: "boolean",
25
- },
18
+ ttl: "[number]",
19
+ input: "[boolean]",
20
+ auth: "[boolean]",
21
+ datasource: "[boolean]",
22
+ ip: "[boolean]",
23
+ "headers?": ["[string]"],
24
+ "env?": ["[string]"],
26
25
  },
27
26
  ],
28
27
  });
@@ -12,7 +12,7 @@ export function utilGetRawInputFn($) {
12
12
  ARGS: [
13
13
  fnToken,
14
14
  {
15
- "encoding?": ["json", "yaml", "x-www-form-urlencoded", ""],
15
+ "encoding?": ["json", "none", "yaml", "x-www-form-urlencoded", ""],
16
16
  "description?": "[string]",
17
17
  "disabled?": "[boolean]",
18
18
  "exclude_middleware?": "[boolean]",
@@ -19,6 +19,13 @@ describe("utilGetRawInputFn", () => {
19
19
  expect(parser.errors).to.be.empty;
20
20
  });
21
21
 
22
+ it("utilGetRawInputFn accepts none as an encoding attribute", () => {
23
+ const parser = parse(`get_raw_input {
24
+ encoding = "none"
25
+ } as $x4`);
26
+ expect(parser.errors).to.be.empty;
27
+ });
28
+
22
29
  it("utilGetRawInputFn encoding attribute is optional", () => {
23
30
  const parser = parse(`get_raw_input as $x4`);
24
31
  expect(parser.errors).to.be.empty;
@@ -1,6 +1,23 @@
1
1
  import { DotToken } from "../../lexer/tokens.js";
2
2
  import { UpdateToken, VarToken } from "../../lexer/var.js";
3
- import { ShortFormVariable } from "../../lexer/variables.js";
3
+ import {
4
+ ApiBaseUrlVariable,
5
+ BranchVariable,
6
+ DatasourceVariable,
7
+ HttpHeadersVariable,
8
+ RemoteHostVariable,
9
+ RemoteIpVariable,
10
+ RemotePasswordVariable,
11
+ RemotePortVariable,
12
+ RemoteUserVariable,
13
+ RequestAuthTokenVariable,
14
+ RequestMethod,
15
+ RequestQuerystringVariable,
16
+ RequestUriVariable,
17
+ ShortFormVariable,
18
+ TenantVariable,
19
+ WebflowVariable,
20
+ } from "../../lexer/variables.js";
4
21
 
5
22
  /**
6
23
  * represent $var.x or $x, the only format accepting an assigment
@@ -15,7 +32,27 @@ export function varFn($) {
15
32
  {
16
33
  // "var $users"
17
34
  ALT: () => {
18
- const variable = $.CONSUME(ShortFormVariable);
35
+ // "$users" or env property tokens like "$http_headers"
36
+ // TODO: probably a good idea to add a warning when an reserved env property
37
+ // token is used as a variable name
38
+ const variable = $.OR1([
39
+ { ALT: () => $.CONSUME(ShortFormVariable) },
40
+ { ALT: () => $.CONSUME(ApiBaseUrlVariable) },
41
+ { ALT: () => $.CONSUME(BranchVariable) },
42
+ { ALT: () => $.CONSUME(DatasourceVariable) },
43
+ { ALT: () => $.CONSUME(HttpHeadersVariable) },
44
+ { ALT: () => $.CONSUME(RemoteHostVariable) },
45
+ { ALT: () => $.CONSUME(RemoteIpVariable) },
46
+ { ALT: () => $.CONSUME(RemotePasswordVariable) },
47
+ { ALT: () => $.CONSUME(RemotePortVariable) },
48
+ { ALT: () => $.CONSUME(RemoteUserVariable) },
49
+ { ALT: () => $.CONSUME(RequestAuthTokenVariable) },
50
+ { ALT: () => $.CONSUME(RequestMethod) },
51
+ { ALT: () => $.CONSUME(RequestQuerystringVariable) },
52
+ { ALT: () => $.CONSUME(RequestUriVariable) },
53
+ { ALT: () => $.CONSUME(TenantVariable) },
54
+ { ALT: () => $.CONSUME(WebflowVariable) },
55
+ ]);
19
56
  if (variable.image) {
20
57
  // we can directly add the variable here but
21
58
  // not necessary for the `assignableVariableProperty` below
@@ -84,6 +84,13 @@ describe("varFn", () => {
84
84
  expect(parser.errors).to.be.empty;
85
85
  });
86
86
 
87
+ it("varFn accept scientific notation", () => {
88
+ const parser = parse(` var $x1 {
89
+ value = 4.21E-6
90
+ }`);
91
+ expect(parser.errors).to.be.empty;
92
+ });
93
+
87
94
  it("varFn expect a variable name", () => {
88
95
  const parser = parse(`var {
89
96
  value = "email"
@@ -92,6 +99,13 @@ describe("varFn", () => {
92
99
  expect(parser.errors).to.not.be.empty;
93
100
  });
94
101
 
102
+ it("varFn accepts an $env.$http_headers object as the value", () => {
103
+ const parser = parse(`var $http_headers {
104
+ value = $env.$http_headers
105
+ }`);
106
+ expect(parser.errors).to.be.empty;
107
+ });
108
+
95
109
  it("varFn expect an as variable to be an identifier", () => {
96
110
  const parser = parse(`var "user" {
97
111
  value = "email"
@@ -107,6 +121,13 @@ describe("varFn", () => {
107
121
  expect(parser.errors).to.be.empty;
108
122
  });
109
123
 
124
+ it("varFn can update a value", () => {
125
+ const parser = parse(`var.update $http_headers.Referer {
126
+ value = "example.com"
127
+ }`);
128
+ expect(parser.errors).to.be.empty;
129
+ });
130
+
110
131
  it("should allow accessing a property from an object defined in place", () => {
111
132
  let parser = parse(`var $config {
112
133
  value = {
@@ -1,6 +1,24 @@
1
1
  import { PipeToken } from "../../lexer/control.js";
2
2
  import { DotToken, Identifier, NewlineToken } from "../../lexer/tokens.js";
3
- import { LongFormVariable, ShortFormVariable } from "../../lexer/variables.js";
3
+ import {
4
+ ApiBaseUrlVariable,
5
+ BranchVariable,
6
+ DatasourceVariable,
7
+ HttpHeadersVariable,
8
+ LongFormVariable,
9
+ RemoteHostVariable,
10
+ RemoteIpVariable,
11
+ RemotePasswordVariable,
12
+ RemotePortVariable,
13
+ RemoteUserVariable,
14
+ RequestAuthTokenVariable,
15
+ RequestMethod,
16
+ RequestQuerystringVariable,
17
+ RequestUriVariable,
18
+ ShortFormVariable,
19
+ TenantVariable,
20
+ WebflowVariable,
21
+ } from "../../lexer/variables.js";
4
22
 
5
23
  /**
6
24
  * represent $var.x or $x, the only format accepting an assigment
@@ -11,10 +29,29 @@ export function assignableVariableProperty($) {
11
29
  let variableName = "";
12
30
  $.OR({
13
31
  DEF: [
14
- // "$users"
32
+ // "$users" or env property tokens like "$http_headers"
33
+ // TODO: probably a good idea to add a warning when an reserved env property
34
+ // token is used as a variable name
15
35
  {
16
36
  ALT: () => {
17
- const variable = $.CONSUME(ShortFormVariable);
37
+ const variable = $.OR1([
38
+ { ALT: () => $.CONSUME(ShortFormVariable) },
39
+ { ALT: () => $.CONSUME(ApiBaseUrlVariable) },
40
+ { ALT: () => $.CONSUME(BranchVariable) },
41
+ { ALT: () => $.CONSUME(DatasourceVariable) },
42
+ { ALT: () => $.CONSUME(HttpHeadersVariable) },
43
+ { ALT: () => $.CONSUME(RemoteHostVariable) },
44
+ { ALT: () => $.CONSUME(RemoteIpVariable) },
45
+ { ALT: () => $.CONSUME(RemotePasswordVariable) },
46
+ { ALT: () => $.CONSUME(RemotePortVariable) },
47
+ { ALT: () => $.CONSUME(RemoteUserVariable) },
48
+ { ALT: () => $.CONSUME(RequestAuthTokenVariable) },
49
+ { ALT: () => $.CONSUME(RequestMethod) },
50
+ { ALT: () => $.CONSUME(RequestQuerystringVariable) },
51
+ { ALT: () => $.CONSUME(RequestUriVariable) },
52
+ { ALT: () => $.CONSUME(TenantVariable) },
53
+ { ALT: () => $.CONSUME(WebflowVariable) },
54
+ ]);
18
55
  variableName = variable.image;
19
56
  },
20
57
  },
@@ -38,7 +38,7 @@ export function completeEnvVariable($) {
38
38
  {
39
39
  ALT: () => {
40
40
  $.CONSUME(HttpHeadersVariable);
41
- $.SUBRULE($.singleChainedIdentifier);
41
+ $.OPTION(() => $.SUBRULE($.singleChainedIdentifier));
42
42
  },
43
43
  },
44
44
  { ALT: () => $.CONSUME(RemoteHostVariable) },
@@ -62,6 +62,11 @@ describe("completeEnvVariable", () => {
62
62
  expect(parser.errors).to.be.empty;
63
63
  });
64
64
 
65
+ it("completeEnvVariable accepts $http_headers without property access", () => {
66
+ const parser = parse("$env.$http_headers");
67
+ expect(parser.errors).to.be.empty;
68
+ });
69
+
65
70
  it("completeEnvVariable warn when using env variable starting with $", () => {
66
71
  const parser = parse("$env.$my_custom_variable");
67
72
  expect(parser.errors).to.be.empty;
@@ -187,6 +187,11 @@ describe("expressionFn", () => {
187
187
  expect(parser.errors).to.be.empty;
188
188
  });
189
189
 
190
+ it("expressionFn can be a scientific notation", () => {
191
+ const parser = parse("4.21E-6");
192
+ expect(parser.errors).to.be.empty;
193
+ });
194
+
190
195
  it("expressionFn accepts a JSON", () => {
191
196
  const parser = parse(`[
192
197
  {
@@ -270,7 +275,7 @@ describe("expressionFn", () => {
270
275
 
271
276
  it("expressionFn accepts a rich boolean test expression", () => {
272
277
  const parser = parse(
273
- `($event_type == "app_mention") || (($event_type == "message") && ($channel_type == "im")) || $thread_replies.ai_bot_thread`
278
+ `($event_type == "app_mention") || (($event_type == "message") && ($channel_type == "im")) || $thread_replies.ai_bot_thread`,
274
279
  );
275
280
  expect(parser.errors).to.be.empty;
276
281
  });
@@ -323,7 +328,7 @@ describe("expressionFn", () => {
323
328
 
324
329
  it("expressionFn allow concat operator", () => {
325
330
  const parser = parse(
326
- `"Given the conversation history and the latest message:\\n\\"" ~ $latestMessage ~ "\\"\\n\\nWho should act next? Or should we FINISH? Select one of: " ~ ($memberOptions|join:", ") ~ "."`
331
+ `"Given the conversation history and the latest message:\\n\\"" ~ $latestMessage ~ "\\"\\n\\nWho should act next? Or should we FINISH? Select one of: " ~ ($memberOptions|join:", ") ~ "."`,
327
332
  );
328
333
  expect(parser.errors).to.be.empty;
329
334
  });
@@ -374,14 +379,14 @@ describe("expressionFn", () => {
374
379
 
375
380
  it("expressionFn should accept chained filters in parenthesis", () => {
376
381
  const parser = parse(
377
- `(now|to_timestamp|add:2:2|add:2|transform_timestamp:"24 hours ago":"UTC")`
382
+ `(now|to_timestamp|add:2:2|add:2|transform_timestamp:"24 hours ago":"UTC")`,
378
383
  );
379
384
  expect(parser.errors).to.be.empty;
380
385
  });
381
386
 
382
387
  it("expressionFn should accept chained filters with comparison", () => {
383
388
  const parser = parse(
384
- `(now|to_timestamp|transform_timestamp:"24 hours ago":"UTC") > (335|add:2)`
389
+ `(now|to_timestamp|transform_timestamp:"24 hours ago":"UTC") > (335|add:2)`,
385
390
  );
386
391
  expect(parser.errors).to.be.empty;
387
392
  });
@@ -1,5 +1,3 @@
1
- import { arrayOfObjectAttrReq } from "./arrayOfObjectAttrReq.js";
2
- import { arrayOfStringLiterals } from "./arrayOfStringLiterals.js";
3
1
  import { arrayWithValues } from "./arrayWithValues.js";
4
2
  import { assignableVariableAs } from "./assignableVariableAs.js";
5
3
  import { assignableVariableProperty } from "./assignableVariableProperty.js";
@@ -28,7 +26,6 @@ import { minimalFnBody } from "./minimalFnBody.js";
28
26
  import { mockAttribute } from "./mockAttribute.js";
29
27
  import { multilineFilterFn } from "./multilineFilterFn.js";
30
28
  import { numberValue } from "./numberValue.js";
31
- import { objectAttrReq } from "./objectAttrReq.js";
32
29
  import { objectWithAttributes } from "./objectWithAttributes.js";
33
30
  import {
34
31
  commentBlockFn,
@@ -48,29 +45,21 @@ import { variableOnly } from "./variableOnly.js";
48
45
  */
49
46
  export const register = ($) => {
50
47
  $.mockAttribute = $.RULE("mockAttribute", mockAttribute($));
51
- $.arrayOfObjectAttrReq = $.RULE(
52
- "arrayOfObjectAttrReq",
53
- arrayOfObjectAttrReq($)
54
- );
55
- $.arrayOfStringLiterals = $.RULE(
56
- "arrayOfStringLiterals",
57
- arrayOfStringLiterals($)
58
- );
59
48
  $.arrayWithValues = $.RULE("arrayWithValues", arrayWithValues($));
60
49
  $.assignableVariableAs = $.RULE(
61
50
  "assignableVariableAs",
62
- assignableVariableAs($)
51
+ assignableVariableAs($),
63
52
  );
64
53
  $.assignableVariableProperty = $.RULE(
65
54
  "assignableVariableProperty",
66
- assignableVariableProperty($)
55
+ assignableVariableProperty($),
67
56
  );
68
57
  $.booleanValue = $.RULE("booleanValue", booleanValue($));
69
58
  $.castedValue = $.RULE("castedValue", castedValue($));
70
59
  $.chainedIdentifier = $.RULE("chainedIdentifier", chainedIdentifier($));
71
60
  $.singleChainedIdentifier = $.RULE(
72
61
  "singleChainedIdentifier",
73
- singleChainedIdentifier($)
62
+ singleChainedIdentifier($),
74
63
  );
75
64
  $.enumValue = $.RULE("enumValue", enumValue($));
76
65
  $.expressionFn = $.RULE("expressionFn", expressionFn($));
@@ -82,10 +71,9 @@ export const register = ($) => {
82
71
  $.longFormVariable = $.RULE("longFormVariable", longFormVariable($));
83
72
  $.minimalFnBody = $.RULE("minimalFnBody", minimalFnBody($));
84
73
  $.numberValue = $.RULE("numberValue", numberValue($));
85
- $.objectAttrReq = $.RULE("objectAttrReq", objectAttrReq($));
86
74
  $.objectWithAttributes = $.RULE(
87
75
  "objectWithAttributes",
88
- objectWithAttributes($)
76
+ objectWithAttributes($),
89
77
  );
90
78
  $.pipedFilter = $.RULE("pipedFilter", pipedFilter($));
91
79
  $.requiredValueFnBody = $.RULE("requiredValueFnBody", requiredValueFnBody($));
@@ -94,31 +82,31 @@ export const register = ($) => {
94
82
  $.tagsAttribute = $.RULE("tagsAttribute", tagsAttribute($));
95
83
  $.expressionFnForResponse = $.RULE(
96
84
  "valueExpressionForResponse",
97
- valueExpressionForResponse($)
85
+ valueExpressionForResponse($),
98
86
  );
99
87
  $.variableOnly = $.RULE("variableOnly", variableOnly($));
100
88
  $.completeAuthVariable = $.RULE(
101
89
  "completeAuthVariable",
102
- completeAuthVariable($)
90
+ completeAuthVariable($),
103
91
  );
104
92
  $.bracketAccessor = $.RULE("bracketAccessor", bracketAccessor($));
105
93
  $.bracketArrayAccessor = $.RULE(
106
94
  "bracketArrayAccessor",
107
- bracketArrayAccessor($)
95
+ bracketArrayAccessor($),
108
96
  );
109
97
  $.completeInputVariable = $.RULE(
110
98
  "completeInputVariable",
111
- completeInputVariable($)
99
+ completeInputVariable($),
112
100
  );
113
101
  $.completeErrorVariable = $.RULE(
114
102
  "completeErrorVariable",
115
- completeErrorVariable($)
103
+ completeErrorVariable($),
116
104
  );
117
105
  $.completeEnvVariable = $.RULE("completeEnvVariable", completeEnvVariable($));
118
106
  $.asVariable = $.RULE("asVariable", asVariable($));
119
107
  $.optionalCommentBlockFn = $.RULE(
120
108
  "optionalCommentBlockFn",
121
- optionalCommentBlockFn($)
109
+ optionalCommentBlockFn($),
122
110
  );
123
111
  $.commentBlockFn = $.RULE("commentBlockFn", commentBlockFn($));
124
112
  };
@@ -99,18 +99,16 @@ export function mcpServerDeclaration($) {
99
99
  $.CONSUME2(EqualToken); // "="
100
100
 
101
101
  // [{"name":"tool_name"}]
102
- $.SUBRULE($.arrayOfObjectAttrReq, {
102
+ $.SUBRULE($.schemaParseArrayFn, {
103
103
  ARGS: [
104
104
  subParent,
105
- ["name"], // required
106
- ["active", "auth"], // optional
107
- {
108
- types: {
109
- active: "boolean",
110
- auth: "string",
111
- name: "string",
105
+ [
106
+ {
107
+ name: "[string]",
108
+ "active?": "[boolean]",
109
+ "auth?": "[string]",
112
110
  },
113
- },
111
+ ],
114
112
  ],
115
113
  });
116
114
  },
@@ -43,15 +43,11 @@ export function mcpServerTriggerDeclaration($) {
43
43
  const subParent = $.CONSUME(ActionsToken); // "actions"
44
44
  $.CONSUME(EqualToken); // "="
45
45
 
46
- $.SUBRULE($.objectAttrReq, {
46
+ $.SUBRULE($.schemaParseObjectFn, {
47
47
  ARGS: [
48
48
  subParent,
49
- ["connection"],
50
- [],
51
49
  {
52
- types: {
53
- connection: "boolean",
54
- },
50
+ connection: "[boolean]",
55
51
  },
56
52
  ],
57
53
  });
@@ -41,16 +41,12 @@ export function realtimeTriggerDeclaration($) {
41
41
  const subParent = $.CONSUME(ActionsToken); // "actions"
42
42
  $.CONSUME(EqualToken); // "="
43
43
 
44
- $.SUBRULE($.objectAttrReq, {
44
+ $.SUBRULE($.schemaParseObjectFn, {
45
45
  ARGS: [
46
46
  subParent,
47
- [], // required
48
- ["join", "message"], // optional
49
47
  {
50
- types: {
51
- join: "boolean",
52
- message: "boolean",
53
- },
48
+ "join?": "[boolean]",
49
+ "message?": "[boolean]",
54
50
  },
55
51
  ],
56
52
  });