scorecard-ai-mcp 1.0.0-alpha.6 → 1.0.0-alpha.7

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 (165) hide show
  1. package/README.md +32 -5
  2. package/dynamic-tools.d.mts +12 -0
  3. package/dynamic-tools.d.mts.map +1 -0
  4. package/dynamic-tools.d.ts +12 -0
  5. package/dynamic-tools.d.ts.map +1 -0
  6. package/dynamic-tools.js +133 -0
  7. package/dynamic-tools.js.map +1 -0
  8. package/dynamic-tools.mjs +130 -0
  9. package/dynamic-tools.mjs.map +1 -0
  10. package/index.js +15 -18
  11. package/index.js.map +1 -1
  12. package/index.mjs +17 -20
  13. package/index.mjs.map +1 -1
  14. package/options.d.mts +2 -0
  15. package/options.d.mts.map +1 -1
  16. package/options.d.ts +2 -0
  17. package/options.d.ts.map +1 -1
  18. package/options.js +17 -0
  19. package/options.js.map +1 -1
  20. package/options.mjs +17 -0
  21. package/options.mjs.map +1 -1
  22. package/package.json +13 -20
  23. package/server.d.mts +6 -1
  24. package/server.d.mts.map +1 -1
  25. package/server.d.ts +6 -1
  26. package/server.d.ts.map +1 -1
  27. package/server.js +20 -1
  28. package/server.js.map +1 -1
  29. package/server.mjs +21 -3
  30. package/server.mjs.map +1 -1
  31. package/src/dynamic-tools.ts +152 -0
  32. package/src/index.ts +19 -23
  33. package/src/options.ts +22 -0
  34. package/src/server.ts +33 -3
  35. package/src/tools/index.ts +5 -5
  36. package/src/tools/projects/create-projects.ts +36 -0
  37. package/src/tools/scores/upsert-scores.ts +40 -0
  38. package/tools/index.d.mts.map +1 -1
  39. package/tools/index.d.ts.map +1 -1
  40. package/tools/index.js +5 -4
  41. package/tools/index.js.map +1 -1
  42. package/tools/index.mjs +5 -4
  43. package/tools/index.mjs.map +1 -1
  44. package/tools/projects/create-projects.d.mts +32 -0
  45. package/tools/projects/create-projects.d.mts.map +1 -0
  46. package/tools/projects/create-projects.d.ts +32 -0
  47. package/tools/projects/create-projects.d.ts.map +1 -0
  48. package/tools/projects/create-projects.js +33 -0
  49. package/tools/projects/create-projects.js.map +1 -0
  50. package/tools/projects/create-projects.mjs +29 -0
  51. package/tools/projects/create-projects.mjs.map +1 -0
  52. package/tools/projects/list-projects.d.mts +10 -2
  53. package/tools/projects/list-projects.d.mts.map +1 -1
  54. package/tools/projects/list-projects.d.ts +10 -2
  55. package/tools/projects/list-projects.d.ts.map +1 -1
  56. package/tools/records/create-records.d.mts +8 -0
  57. package/tools/records/create-records.d.mts.map +1 -1
  58. package/tools/records/create-records.d.ts +8 -0
  59. package/tools/records/create-records.d.ts.map +1 -1
  60. package/tools/runs/create-runs.d.mts +8 -0
  61. package/tools/runs/create-runs.d.mts.map +1 -1
  62. package/tools/runs/create-runs.d.ts +8 -0
  63. package/tools/runs/create-runs.d.ts.map +1 -1
  64. package/tools/runs/update-runs.d.mts +8 -0
  65. package/tools/runs/update-runs.d.mts.map +1 -1
  66. package/tools/runs/update-runs.d.ts +8 -0
  67. package/tools/runs/update-runs.d.ts.map +1 -1
  68. package/tools/scores/upsert-scores.d.mts +32 -0
  69. package/tools/scores/upsert-scores.d.mts.map +1 -0
  70. package/tools/scores/upsert-scores.d.ts +32 -0
  71. package/tools/scores/upsert-scores.d.ts.map +1 -0
  72. package/tools/scores/upsert-scores.js +35 -0
  73. package/tools/scores/upsert-scores.js.map +1 -0
  74. package/tools/scores/upsert-scores.mjs +31 -0
  75. package/tools/scores/upsert-scores.mjs.map +1 -0
  76. package/tools/system-configs/create-system-configs.d.mts +8 -0
  77. package/tools/system-configs/create-system-configs.d.mts.map +1 -1
  78. package/tools/system-configs/create-system-configs.d.ts +8 -0
  79. package/tools/system-configs/create-system-configs.d.ts.map +1 -1
  80. package/tools/system-configs/get-system-configs.d.mts +8 -0
  81. package/tools/system-configs/get-system-configs.d.mts.map +1 -1
  82. package/tools/system-configs/get-system-configs.d.ts +8 -0
  83. package/tools/system-configs/get-system-configs.d.ts.map +1 -1
  84. package/tools/system-configs/list-system-configs.d.mts +8 -0
  85. package/tools/system-configs/list-system-configs.d.mts.map +1 -1
  86. package/tools/system-configs/list-system-configs.d.ts +8 -0
  87. package/tools/system-configs/list-system-configs.d.ts.map +1 -1
  88. package/tools/systems/create-systems.d.mts +8 -0
  89. package/tools/systems/create-systems.d.mts.map +1 -1
  90. package/tools/systems/create-systems.d.ts +8 -0
  91. package/tools/systems/create-systems.d.ts.map +1 -1
  92. package/tools/systems/delete-systems.d.mts +8 -0
  93. package/tools/systems/delete-systems.d.mts.map +1 -1
  94. package/tools/systems/delete-systems.d.ts +8 -0
  95. package/tools/systems/delete-systems.d.ts.map +1 -1
  96. package/tools/systems/get-systems.d.mts +8 -0
  97. package/tools/systems/get-systems.d.mts.map +1 -1
  98. package/tools/systems/get-systems.d.ts +8 -0
  99. package/tools/systems/get-systems.d.ts.map +1 -1
  100. package/tools/systems/list-systems.d.mts +8 -0
  101. package/tools/systems/list-systems.d.mts.map +1 -1
  102. package/tools/systems/list-systems.d.ts +8 -0
  103. package/tools/systems/list-systems.d.ts.map +1 -1
  104. package/tools/systems/update-systems.d.mts +8 -0
  105. package/tools/systems/update-systems.d.mts.map +1 -1
  106. package/tools/systems/update-systems.d.ts +8 -0
  107. package/tools/systems/update-systems.d.ts.map +1 -1
  108. package/tools/testcases/create-testcases.d.mts +8 -0
  109. package/tools/testcases/create-testcases.d.mts.map +1 -1
  110. package/tools/testcases/create-testcases.d.ts +8 -0
  111. package/tools/testcases/create-testcases.d.ts.map +1 -1
  112. package/tools/testcases/delete-testcases.d.mts +8 -0
  113. package/tools/testcases/delete-testcases.d.mts.map +1 -1
  114. package/tools/testcases/delete-testcases.d.ts +8 -0
  115. package/tools/testcases/delete-testcases.d.ts.map +1 -1
  116. package/tools/testcases/get-testcases.d.mts +8 -0
  117. package/tools/testcases/get-testcases.d.mts.map +1 -1
  118. package/tools/testcases/get-testcases.d.ts +8 -0
  119. package/tools/testcases/get-testcases.d.ts.map +1 -1
  120. package/tools/testcases/list-testcases.d.mts +8 -0
  121. package/tools/testcases/list-testcases.d.mts.map +1 -1
  122. package/tools/testcases/list-testcases.d.ts +8 -0
  123. package/tools/testcases/list-testcases.d.ts.map +1 -1
  124. package/tools/testcases/update-testcases.d.mts +8 -0
  125. package/tools/testcases/update-testcases.d.mts.map +1 -1
  126. package/tools/testcases/update-testcases.d.ts +8 -0
  127. package/tools/testcases/update-testcases.d.ts.map +1 -1
  128. package/tools/testsets/create-testsets.d.mts +8 -0
  129. package/tools/testsets/create-testsets.d.mts.map +1 -1
  130. package/tools/testsets/create-testsets.d.ts +8 -0
  131. package/tools/testsets/create-testsets.d.ts.map +1 -1
  132. package/tools/testsets/delete-testsets.d.mts +8 -0
  133. package/tools/testsets/delete-testsets.d.mts.map +1 -1
  134. package/tools/testsets/delete-testsets.d.ts +8 -0
  135. package/tools/testsets/delete-testsets.d.ts.map +1 -1
  136. package/tools/testsets/get-testsets.d.mts +8 -0
  137. package/tools/testsets/get-testsets.d.mts.map +1 -1
  138. package/tools/testsets/get-testsets.d.ts +8 -0
  139. package/tools/testsets/get-testsets.d.ts.map +1 -1
  140. package/tools/testsets/list-testsets.d.mts +8 -0
  141. package/tools/testsets/list-testsets.d.mts.map +1 -1
  142. package/tools/testsets/list-testsets.d.ts +8 -0
  143. package/tools/testsets/list-testsets.d.ts.map +1 -1
  144. package/tools/testsets/update-testsets.d.mts +8 -0
  145. package/tools/testsets/update-testsets.d.mts.map +1 -1
  146. package/tools/testsets/update-testsets.d.ts +8 -0
  147. package/tools/testsets/update-testsets.d.ts.map +1 -1
  148. package/compat.test.d.mts +0 -2
  149. package/compat.test.d.mts.map +0 -1
  150. package/compat.test.d.ts +0 -2
  151. package/compat.test.d.ts.map +0 -1
  152. package/compat.test.js +0 -950
  153. package/compat.test.js.map +0 -1
  154. package/compat.test.mjs +0 -948
  155. package/compat.test.mjs.map +0 -1
  156. package/options.test.d.mts +0 -2
  157. package/options.test.d.mts.map +0 -1
  158. package/options.test.d.ts +0 -2
  159. package/options.test.d.ts.map +0 -1
  160. package/options.test.js +0 -154
  161. package/options.test.js.map +0 -1
  162. package/options.test.mjs +0 -152
  163. package/options.test.mjs.map +0 -1
  164. package/src/compat.test.ts +0 -1068
  165. package/src/options.test.ts +0 -193
package/README.md CHANGED
@@ -10,7 +10,7 @@ You can run the MCP Server directly via `npx`:
10
10
 
11
11
  ```sh
12
12
  export SCORECARD_API_KEY="My API Key"
13
- npx -y scorecard-ai-mcp
13
+ npx -y scorecard-ai-mcp@latest
14
14
  ```
15
15
 
16
16
  ### Via MCP Client
@@ -25,7 +25,7 @@ For clients with a configuration JSON, it might look something like this:
25
25
  "mcpServers": {
26
26
  "scorecard_ai_api": {
27
27
  "command": "npx",
28
- "args": ["-y", "scorecard-ai-mcp", "--client=claude"],
28
+ "args": ["-y", "scorecard-ai-mcp", "--client=claude", "--tools=dynamic"],
29
29
  "env": {
30
30
  "SCORECARD_API_KEY": "My API Key"
31
31
  }
@@ -34,7 +34,14 @@ For clients with a configuration JSON, it might look something like this:
34
34
  }
35
35
  ```
36
36
 
37
- ## Filtering tools
37
+ ## Exposing endpoints to your MCP Client
38
+
39
+ There are two ways to expose endpoints as tools in the MCP server:
40
+
41
+ 1. Exposing one tool per endpoint, and filtering as necessary
42
+ 2. Exposing a set of tools to dynamically discover and invoke endpoints from the API
43
+
44
+ ### Filtering endpoints and tools
38
45
 
39
46
  You can run the package on the command line to discover and filter the set of tools that are exposed by the
40
47
  MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
@@ -46,6 +53,21 @@ You can filter by multiple aspects:
46
53
  - `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
47
54
  - `--operation` includes just read (get/list) or just write operations
48
55
 
56
+ ### Dynamic tools
57
+
58
+ If you specify `--tools=dynamic` to the MCP server, instead of exposing one tool per endpoint in the API, it will
59
+ expose the following tools:
60
+
61
+ 1. `list_api_endpoints` - Discovers available endpoints, with optional filtering by search query
62
+ 2. `get_api_endpoint_schema` - Gets detailed schema information for a specific endpoint
63
+ 3. `invoke_api_endpoint` - Executes any endpoint with the appropriate parameters
64
+
65
+ This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
66
+ of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
67
+ search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
68
+ can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
69
+ you can opt-in to explicit tools, the dynamic tools, or both.
70
+
49
71
  See more information with `--help`.
50
72
 
51
73
  All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
@@ -111,7 +133,7 @@ over time, you can manually enable or disable certain capabilities:
111
133
  import { server, endpoints, init } from "scorecard-ai-mcp/server";
112
134
 
113
135
  // import a specific tool
114
- import listProjects from "scorecard-ai-mcp/tools/projects/list-projects";
136
+ import createProjects from "scorecard-ai-mcp/tools/projects/create-projects";
115
137
 
116
138
  // initialize the server and all endpoints
117
139
  init({ server, endpoints });
@@ -136,7 +158,7 @@ const myCustomEndpoint = {
136
158
  };
137
159
 
138
160
  // initialize the server with your custom endpoints
139
- init({ server: myServer, endpoints: [listProjects, myCustomEndpoint] });
161
+ init({ server: myServer, endpoints: [createProjects, myCustomEndpoint] });
140
162
  ```
141
163
 
142
164
  ## Available Tools
@@ -145,6 +167,7 @@ The following tools are available in this MCP server.
145
167
 
146
168
  ### Resource `projects`:
147
169
 
170
+ - `create_projects` (`write`): Create a new Project.
148
171
  - `list_projects` (`read`): Retrieve a paginated list of all Projects. Projects are ordered by creation date, with oldest Projects first.
149
172
 
150
173
  ### Resource `testsets`:
@@ -181,6 +204,10 @@ When updating the schema:
181
204
 
182
205
  - `create_records` (`write`): Create a new Record in a Run.
183
206
 
207
+ ### Resource `scores`:
208
+
209
+ - `upsert_scores` (`write`): Create or update a Score for a given Record and MetricConfig. If a Score with the specified Record ID and MetricConfig ID already exists, it will be updated. Otherwise, a new Score will be created. The score provided should conform to the schema defined by the MetricConfig; otherwise, validation errors will be reported.
210
+
184
211
  ### Resource `systems`:
185
212
 
186
213
  - `create_systems` (`write`): Create a new system definition that specifies the interface contracts for a component you want to evaluate.
@@ -0,0 +1,12 @@
1
+ import { Endpoint } from "./tools.mjs";
2
+ /**
3
+ * A list of tools that expose all the endpoints in the API dynamically.
4
+ *
5
+ * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
6
+ * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
7
+ * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
8
+ *
9
+ * @param endpoints - The endpoints to include in the list.
10
+ */
11
+ export declare function dynamicTools(endpoints: Endpoint[]): Endpoint[];
12
+ //# sourceMappingURL=dynamic-tools.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-tools.d.mts","sourceRoot":"","sources":["src/dynamic-tools.ts"],"names":[],"mappings":"OACO,EAAE,QAAQ,EAAE;AAYnB;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAiI9D"}
@@ -0,0 +1,12 @@
1
+ import { Endpoint } from "./tools.js";
2
+ /**
3
+ * A list of tools that expose all the endpoints in the API dynamically.
4
+ *
5
+ * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
6
+ * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
7
+ * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
8
+ *
9
+ * @param endpoints - The endpoints to include in the list.
10
+ */
11
+ export declare function dynamicTools(endpoints: Endpoint[]): Endpoint[];
12
+ //# sourceMappingURL=dynamic-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-tools.d.ts","sourceRoot":"","sources":["src/dynamic-tools.ts"],"names":[],"mappings":"OACO,EAAE,QAAQ,EAAE;AAYnB;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAiI9D"}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dynamicTools = dynamicTools;
4
+ const zod_to_json_schema_1 = require("zod-to-json-schema");
5
+ const zod_1 = require("zod");
6
+ const cabidela_1 = require("@cloudflare/cabidela");
7
+ function zodToInputSchema(schema) {
8
+ return {
9
+ type: 'object',
10
+ ...(0, zod_to_json_schema_1.zodToJsonSchema)(schema),
11
+ };
12
+ }
13
+ /**
14
+ * A list of tools that expose all the endpoints in the API dynamically.
15
+ *
16
+ * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
17
+ * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
18
+ * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
19
+ *
20
+ * @param endpoints - The endpoints to include in the list.
21
+ */
22
+ function dynamicTools(endpoints) {
23
+ const listEndpointsSchema = zod_1.z.object({
24
+ search_query: zod_1.z
25
+ .string()
26
+ .optional()
27
+ .describe('An optional search query to filter the endpoints by. Provide a partial name, resource, operation, or tag to filter the endpoints returned.'),
28
+ });
29
+ const listEndpointsTool = {
30
+ metadata: {
31
+ resource: 'dynamic_tools',
32
+ operation: 'read',
33
+ tags: [],
34
+ },
35
+ tool: {
36
+ name: 'list_api_endpoints',
37
+ description: 'List or search for all endpoints in the Scorecard TypeScript API',
38
+ inputSchema: zodToInputSchema(listEndpointsSchema),
39
+ },
40
+ handler: async (client, args) => {
41
+ const query = args && listEndpointsSchema.parse(args).search_query?.trim();
42
+ const filteredEndpoints = query && query.length > 0 ?
43
+ endpoints.filter((endpoint) => {
44
+ const fieldsToMatch = [
45
+ endpoint.tool.name,
46
+ endpoint.metadata.resource,
47
+ endpoint.metadata.operation,
48
+ ...endpoint.metadata.tags,
49
+ ];
50
+ return fieldsToMatch.some((field) => field.toLowerCase().includes(query.toLowerCase()));
51
+ })
52
+ : endpoints;
53
+ return {
54
+ tools: filteredEndpoints.map(({ tool, metadata }) => ({
55
+ name: tool.name,
56
+ description: tool.description,
57
+ resource: metadata.resource,
58
+ operation: metadata.operation,
59
+ tags: metadata.tags,
60
+ })),
61
+ };
62
+ },
63
+ };
64
+ const getEndpointSchema = zod_1.z.object({
65
+ endpoint: zod_1.z.string().describe('The name of the endpoint to get the schema for.'),
66
+ });
67
+ const getEndpointTool = {
68
+ metadata: {
69
+ resource: 'dynamic_tools',
70
+ operation: 'read',
71
+ tags: [],
72
+ },
73
+ tool: {
74
+ name: 'get_api_endpoint_schema',
75
+ description: 'Get the schema for an endpoint in the Scorecard TypeScript API. You can use the schema returned by this tool to invoke an endpoint with the `invoke_api_endpoint` tool.',
76
+ inputSchema: zodToInputSchema(getEndpointSchema),
77
+ },
78
+ handler: async (client, args) => {
79
+ if (!args) {
80
+ throw new Error('No endpoint provided');
81
+ }
82
+ const endpointName = getEndpointSchema.parse(args).endpoint;
83
+ const endpoint = endpoints.find((e) => e.tool.name === endpointName);
84
+ if (!endpoint) {
85
+ throw new Error(`Endpoint ${endpointName} not found`);
86
+ }
87
+ return endpoint.tool;
88
+ },
89
+ };
90
+ const invokeEndpointSchema = zod_1.z.object({
91
+ endpoint_name: zod_1.z.string().describe('The name of the endpoint to invoke.'),
92
+ args: zod_1.z
93
+ .record(zod_1.z.string(), zod_1.z.any())
94
+ .describe('The arguments to pass to the endpoint. This must match the schema returned by the `get_api_endpoint_schema` tool.'),
95
+ });
96
+ const invokeEndpointTool = {
97
+ metadata: {
98
+ resource: 'dynamic_tools',
99
+ operation: 'write',
100
+ tags: [],
101
+ },
102
+ tool: {
103
+ name: 'invoke_api_endpoint',
104
+ description: 'Invoke an endpoint in the Scorecard TypeScript API. Note: use the `list_api_endpoints` tool to get the list of endpoints and `get_api_endpoint_schema` tool to get the schema for an endpoint.',
105
+ inputSchema: zodToInputSchema(invokeEndpointSchema),
106
+ },
107
+ handler: async (client, args) => {
108
+ if (!args) {
109
+ throw new Error('No endpoint provided');
110
+ }
111
+ const { success, data, error } = invokeEndpointSchema.safeParse(args);
112
+ if (!success) {
113
+ throw new Error(`Invalid arguments for endpoint. ${error?.format()}`);
114
+ }
115
+ const { endpoint_name, args: endpointArgs } = data;
116
+ const endpoint = endpoints.find((e) => e.tool.name === endpoint_name);
117
+ if (!endpoint) {
118
+ throw new Error(`Endpoint ${endpoint_name} not found. Use the \`list_api_endpoints\` tool to get the list of available endpoints.`);
119
+ }
120
+ try {
121
+ // Try to validate the arguments for a better error message
122
+ const cabidela = new cabidela_1.Cabidela(endpoint.tool.inputSchema, { fullErrors: true });
123
+ cabidela.validate(endpointArgs);
124
+ }
125
+ catch (error) {
126
+ throw new Error(`Invalid arguments for endpoint ${endpoint_name}:\n${error}`);
127
+ }
128
+ return endpoint.handler(client, endpointArgs);
129
+ },
130
+ };
131
+ return [getEndpointTool, listEndpointsTool, invokeEndpointTool];
132
+ }
133
+ //# sourceMappingURL=dynamic-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-tools.js","sourceRoot":"","sources":["src/dynamic-tools.ts"],"names":[],"mappings":";;AAsBA,oCAiIC;AArJD,2DAAqD;AACrD,6BAAwB;AACxB,mDAAgD;AAEhD,SAAS,gBAAgB,CAAC,MAAmB;IAC3C,OAAO;QACL,IAAI,EAAE,QAAiB;QACvB,GAAI,IAAA,oCAAe,EAAC,MAAM,CAAS;KACpC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAAC,SAAqB;IAChD,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;QACnC,YAAY,EAAE,OAAC;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,4IAA4I,CAC7I;KACJ,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG;QACxB,QAAQ,EAAE;YACR,QAAQ,EAAE,eAAe;YACzB,SAAS,EAAE,MAAe;YAC1B,IAAI,EAAE,EAAE;SACT;QACD,IAAI,EAAE;YACJ,IAAI,EAA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C;YAED,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,eAAe,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,130 @@
1
+ import { zodToJsonSchema } from 'zod-to-json-schema';
2
+ import { z } from 'zod';
3
+ import { Cabidela } from '@cloudflare/cabidela';
4
+ function zodToInputSchema(schema) {
5
+ return {
6
+ type: 'object',
7
+ ...zodToJsonSchema(schema),
8
+ };
9
+ }
10
+ /**
11
+ * A list of tools that expose all the endpoints in the API dynamically.
12
+ *
13
+ * Instead of exposing every endpoint as it's own tool, which uses up too many tokens for LLMs to use at once,
14
+ * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
15
+ * a generic endpoint that can be used to invoke any endpoint with the provided arguments.
16
+ *
17
+ * @param endpoints - The endpoints to include in the list.
18
+ */
19
+ export function dynamicTools(endpoints) {
20
+ const listEndpointsSchema = z.object({
21
+ search_query: z
22
+ .string()
23
+ .optional()
24
+ .describe('An optional search query to filter the endpoints by. Provide a partial name, resource, operation, or tag to filter the endpoints returned.'),
25
+ });
26
+ const listEndpointsTool = {
27
+ metadata: {
28
+ resource: 'dynamic_tools',
29
+ operation: 'read',
30
+ tags: [],
31
+ },
32
+ tool: {
33
+ name: 'list_api_endpoints',
34
+ description: 'List or search for all endpoints in the Scorecard TypeScript API',
35
+ inputSchema: zodToInputSchema(listEndpointsSchema),
36
+ },
37
+ handler: async (client, args) => {
38
+ const query = args && listEndpointsSchema.parse(args).search_query?.trim();
39
+ const filteredEndpoints = query && query.length > 0 ?
40
+ endpoints.filter((endpoint) => {
41
+ const fieldsToMatch = [
42
+ endpoint.tool.name,
43
+ endpoint.metadata.resource,
44
+ endpoint.metadata.operation,
45
+ ...endpoint.metadata.tags,
46
+ ];
47
+ return fieldsToMatch.some((field) => field.toLowerCase().includes(query.toLowerCase()));
48
+ })
49
+ : endpoints;
50
+ return {
51
+ tools: filteredEndpoints.map(({ tool, metadata }) => ({
52
+ name: tool.name,
53
+ description: tool.description,
54
+ resource: metadata.resource,
55
+ operation: metadata.operation,
56
+ tags: metadata.tags,
57
+ })),
58
+ };
59
+ },
60
+ };
61
+ const getEndpointSchema = z.object({
62
+ endpoint: z.string().describe('The name of the endpoint to get the schema for.'),
63
+ });
64
+ const getEndpointTool = {
65
+ metadata: {
66
+ resource: 'dynamic_tools',
67
+ operation: 'read',
68
+ tags: [],
69
+ },
70
+ tool: {
71
+ name: 'get_api_endpoint_schema',
72
+ description: 'Get the schema for an endpoint in the Scorecard TypeScript API. You can use the schema returned by this tool to invoke an endpoint with the `invoke_api_endpoint` tool.',
73
+ inputSchema: zodToInputSchema(getEndpointSchema),
74
+ },
75
+ handler: async (client, args) => {
76
+ if (!args) {
77
+ throw new Error('No endpoint provided');
78
+ }
79
+ const endpointName = getEndpointSchema.parse(args).endpoint;
80
+ const endpoint = endpoints.find((e) => e.tool.name === endpointName);
81
+ if (!endpoint) {
82
+ throw new Error(`Endpoint ${endpointName} not found`);
83
+ }
84
+ return endpoint.tool;
85
+ },
86
+ };
87
+ const invokeEndpointSchema = z.object({
88
+ endpoint_name: z.string().describe('The name of the endpoint to invoke.'),
89
+ args: z
90
+ .record(z.string(), z.any())
91
+ .describe('The arguments to pass to the endpoint. This must match the schema returned by the `get_api_endpoint_schema` tool.'),
92
+ });
93
+ const invokeEndpointTool = {
94
+ metadata: {
95
+ resource: 'dynamic_tools',
96
+ operation: 'write',
97
+ tags: [],
98
+ },
99
+ tool: {
100
+ name: 'invoke_api_endpoint',
101
+ description: 'Invoke an endpoint in the Scorecard TypeScript API. Note: use the `list_api_endpoints` tool to get the list of endpoints and `get_api_endpoint_schema` tool to get the schema for an endpoint.',
102
+ inputSchema: zodToInputSchema(invokeEndpointSchema),
103
+ },
104
+ handler: async (client, args) => {
105
+ if (!args) {
106
+ throw new Error('No endpoint provided');
107
+ }
108
+ const { success, data, error } = invokeEndpointSchema.safeParse(args);
109
+ if (!success) {
110
+ throw new Error(`Invalid arguments for endpoint. ${error?.format()}`);
111
+ }
112
+ const { endpoint_name, args: endpointArgs } = data;
113
+ const endpoint = endpoints.find((e) => e.tool.name === endpoint_name);
114
+ if (!endpoint) {
115
+ throw new Error(`Endpoint ${endpoint_name} not found. Use the \`list_api_endpoints\` tool to get the list of available endpoints.`);
116
+ }
117
+ try {
118
+ // Try to validate the arguments for a better error message
119
+ const cabidela = new Cabidela(endpoint.tool.inputSchema, { fullErrors: true });
120
+ cabidela.validate(endpointArgs);
121
+ }
122
+ catch (error) {
123
+ throw new Error(`Invalid arguments for endpoint ${endpoint_name}:\n${error}`);
124
+ }
125
+ return endpoint.handler(client, endpointArgs);
126
+ },
127
+ };
128
+ return [getEndpointTool, listEndpointsTool, invokeEndpointTool];
129
+ }
130
+ //# sourceMappingURL=dynamic-tools.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-tools.mjs","sourceRoot":"","sources":["src/dynamic-tools.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE,MAAM,oBAAoB;OAC7C,EAAE,CAAC,EAAE,MAAM,KAAK;OAChB,EAAE,QAAQ,EAAE,MAAM,sBAAsB;AAE/C,SAAS,gBAAgB,CAAC,MAAmB;IAC3C,OAAO;QACL,IAAI,EAAE,QAAiB;QACvB,GAAI,eAAe,CAAC,MAAM,CAAS;KACpC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,SAAqB;IAChD,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;QACnC,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,4IAA4I,CAC7I;KACJ,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG;QACxB,QAAQ,EAAE;YACR,QAAQ,EAAE,eAAe;YACzB,SAAS,EAAE,MAAe;YAC1B,IAAI,EA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aAAa,MAAM,KAAK,EAAE,CAAC,CAAC;YAChF,CAAC;YAED,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,eAAe,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAClE,CAAC"}
package/index.js CHANGED
@@ -4,19 +4,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
5
5
  const server_1 = require("./server.js");
6
6
  const tools_1 = require("./tools.js");
7
- const compat_1 = require("./compat.js");
8
7
  const options_1 = require("./options.js");
9
8
  async function main() {
10
- const { filters, capabilities, list } = parseOptionsOrError();
11
- if (list) {
9
+ const options = parseOptionsOrError();
10
+ if (options.list) {
12
11
  listAllTools();
13
12
  return;
14
13
  }
15
- const filteredEndpoints = filterEndpointsOrError(filters, tools_1.endpoints);
16
- // Apply compatibility transformations
17
- const transformedEndpoints = (0, compat_1.applyCompatibilityTransformations)(filteredEndpoints, capabilities);
18
- console.error(`MCP Server starting with ${transformedEndpoints.length} tools:`, transformedEndpoints.map((e) => e.tool.name));
19
- (0, server_1.init)({ server: server_1.server, endpoints: transformedEndpoints });
14
+ const includedTools = selectToolsOrError(tools_1.endpoints, options);
15
+ console.error(`MCP Server starting with ${includedTools.length} tools:`, includedTools.map((e) => e.tool.name));
16
+ (0, server_1.init)({ server: server_1.server, endpoints: includedTools });
20
17
  const transport = new stdio_js_1.StdioServerTransport();
21
18
  await server_1.server.connect(transport);
22
19
  console.error('MCP Server running on stdio');
@@ -36,14 +33,14 @@ function parseOptionsOrError() {
36
33
  process.exit(1);
37
34
  }
38
35
  }
39
- function filterEndpointsOrError(filters, endpoints) {
36
+ function selectToolsOrError(endpoints, options) {
40
37
  try {
41
- const filteredEndpoints = (0, tools_1.query)(filters, endpoints);
42
- if (filteredEndpoints.length === 0) {
38
+ const includedTools = (0, server_1.selectTools)(endpoints, options);
39
+ if (includedTools.length === 0) {
43
40
  console.error('No tools match the provided filters.');
44
41
  process.exit(1);
45
42
  }
46
- return filteredEndpoints;
43
+ return includedTools;
47
44
  }
48
45
  catch (error) {
49
46
  if (error instanceof Error) {
@@ -57,10 +54,10 @@ function filterEndpointsOrError(filters, endpoints) {
57
54
  }
58
55
  function listAllTools() {
59
56
  if (tools_1.endpoints.length === 0) {
60
- console.error('No tools available.');
57
+ console.log('No tools available.');
61
58
  return;
62
59
  }
63
- console.error('Available tools:\n');
60
+ console.log('Available tools:\n');
64
61
  // Group endpoints by resource
65
62
  const resourceGroups = new Map();
66
63
  for (const endpoint of tools_1.endpoints) {
@@ -74,16 +71,16 @@ function listAllTools() {
74
71
  const sortedResources = Array.from(resourceGroups.keys()).sort();
75
72
  // Display hierarchically by resource
76
73
  for (const resource of sortedResources) {
77
- console.error(`Resource: ${resource}`);
74
+ console.log(`Resource: ${resource}`);
78
75
  const resourceEndpoints = resourceGroups.get(resource);
79
76
  // Sort endpoints by tool name
80
77
  resourceEndpoints.sort((a, b) => a.tool.name.localeCompare(b.tool.name));
81
78
  for (const endpoint of resourceEndpoints) {
82
79
  const { tool, metadata: { operation, tags }, } = endpoint;
83
- console.error(` - ${tool.name} (${operation}) ${tags.length > 0 ? `tags: ${tags.join(', ')}` : ''}`);
84
- console.error(` Description: ${tool.description}`);
80
+ console.log(` - ${tool.name} (${operation}) ${tags.length > 0 ? `tags: ${tags.join(', ')}` : ''}`);
81
+ console.log(` Description: ${tool.description}`);
85
82
  }
86
- console.error('');
83
+ console.log('');
87
84
  }
88
85
  }
89
86
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;AAAA,wEAAiF;AACjF,wCAAwC;AACxC,sCAA6D;AAC7D,wCAA6D;AAC7D,0CAAyC;AAEzC,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,OAAO,EAAE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,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAEjE,qCAAqC;IACrC,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;QAErC,MAAM,iBAAiB,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QACxD,8BAA8B;QAC9B,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAEzE,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,EACJ,IAAI,EACJ,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAC9B,GAAG,QAAQ,CAAC;YAEb,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
package/index.mjs CHANGED
@@ -1,19 +1,16 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
- import { init, server } from "./server.mjs";
3
- import { endpoints, query } from "./tools.mjs";
4
- import { applyCompatibilityTransformations } from "./compat.mjs";
2
+ import { init, selectTools, server } from "./server.mjs";
3
+ import { endpoints } from "./tools.mjs";
5
4
  import { parseOptions } from "./options.mjs";
6
5
  async function main() {
7
- const { filters, capabilities, list } = parseOptionsOrError();
8
- if (list) {
6
+ const options = parseOptionsOrError();
7
+ if (options.list) {
9
8
  listAllTools();
10
9
  return;
11
10
  }
12
- const filteredEndpoints = filterEndpointsOrError(filters, endpoints);
13
- // Apply compatibility transformations
14
- const transformedEndpoints = applyCompatibilityTransformations(filteredEndpoints, capabilities);
15
- console.error(`MCP Server starting with ${transformedEndpoints.length} tools:`, transformedEndpoints.map((e) => e.tool.name));
16
- init({ server, endpoints: transformedEndpoints });
11
+ const includedTools = selectToolsOrError(endpoints, options);
12
+ console.error(`MCP Server starting with ${includedTools.length} tools:`, includedTools.map((e) => e.tool.name));
13
+ init({ server, endpoints: includedTools });
17
14
  const transport = new StdioServerTransport();
18
15
  await server.connect(transport);
19
16
  console.error('MCP Server running on stdio');
@@ -33,14 +30,14 @@ function parseOptionsOrError() {
33
30
  process.exit(1);
34
31
  }
35
32
  }
36
- function filterEndpointsOrError(filters, endpoints) {
33
+ function selectToolsOrError(endpoints, options) {
37
34
  try {
38
- const filteredEndpoints = query(filters, endpoints);
39
- if (filteredEndpoints.length === 0) {
35
+ const includedTools = selectTools(endpoints, options);
36
+ if (includedTools.length === 0) {
40
37
  console.error('No tools match the provided filters.');
41
38
  process.exit(1);
42
39
  }
43
- return filteredEndpoints;
40
+ return includedTools;
44
41
  }
45
42
  catch (error) {
46
43
  if (error instanceof Error) {
@@ -54,10 +51,10 @@ function filterEndpointsOrError(filters, endpoints) {
54
51
  }
55
52
  function listAllTools() {
56
53
  if (endpoints.length === 0) {
57
- console.error('No tools available.');
54
+ console.log('No tools available.');
58
55
  return;
59
56
  }
60
- console.error('Available tools:\n');
57
+ console.log('Available tools:\n');
61
58
  // Group endpoints by resource
62
59
  const resourceGroups = new Map();
63
60
  for (const endpoint of endpoints) {
@@ -71,16 +68,16 @@ function listAllTools() {
71
68
  const sortedResources = Array.from(resourceGroups.keys()).sort();
72
69
  // Display hierarchically by resource
73
70
  for (const resource of sortedResources) {
74
- console.error(`Resource: ${resource}`);
71
+ console.log(`Resource: ${resource}`);
75
72
  const resourceEndpoints = resourceGroups.get(resource);
76
73
  // Sort endpoints by tool name
77
74
  resourceEndpoints.sort((a, b) => a.tool.name.localeCompare(b.tool.name));
78
75
  for (const endpoint of resourceEndpoints) {
79
76
  const { tool, metadata: { operation, tags }, } = endpoint;
80
- console.error(` - ${tool.name} (${operation}) ${tags.length > 0 ? `tags: ${tags.join(', ')}` : ''}`);
81
- console.error(` Description: ${tool.description}`);
77
+ console.log(` - ${tool.name} (${operation}) ${tags.length > 0 ? `tags: ${tags.join(', ')}` : ''}`);
78
+ console.log(` Description: ${tool.description}`);
82
79
  }
83
- console.error('');
80
+ console.log('');
84
81
  }
85
82
  }
86
83
  //# sourceMappingURL=index.mjs.map
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OACzE,EAAE,IAAI,EAAE,MAAM,EAAE;OAChB,EAAY,SAAS,EAAU,KAAK,EAAE;OACtC,EAAE,iCAAiC,EAAE;OACrC,EAAE,YAAY,EAAE;AAEvB,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAE9D,IAAI,IAAI,EAAE,CAAC;QACT,YAAY,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IAED,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAErE,sCAAsC;IACtC,MAAM,oBAAoB,GAAG,iCAAiC,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAEhG,OAAO,CAAC,KAAK,CACX,4BAA4B,oBAAoB,CAAC,MAAM,SAAS,EAChE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7C,CA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IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,EACJ,IAAI,EACJ,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAC9B,GAAG,QAAQ,CAAC;YAEb,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
package/options.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Filter } from "./tools.mjs";
2
2
  import { ClientCapabilities } from "./compat.mjs";
3
3
  export interface ParsedOptions {
4
+ includeDynamicTools: boolean | undefined;
5
+ includeAllTools: boolean | undefined;
4
6
  filters: Filter[];
5
7
  capabilities: ClientCapabilities;
6
8
  list: boolean;
package/options.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"OAEO,EAAa,MAAM,EAAE;OACrB,EAAE,kBAAkB,EAAE;AA0C7B,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,kBAAkB,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;CACf;AA+BD,wBAAgB,YAAY,IAAI,aAAa,CA6L5C"}
1
+ {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"OAEO,EAAa,MAAM,EAAE;OACrB,EAAE,kBAAkB,EAAE;AA0C7B,MAAM,WAAW,aAAa;IAC5B,mBAAmB,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,kBAAkB,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;CACf;AA+BD,wBAAgB,YAAY,IAAI,aAAa,CAiN5C"}
package/options.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Filter } from "./tools.js";
2
2
  import { ClientCapabilities } from "./compat.js";
3
3
  export interface ParsedOptions {
4
+ includeDynamicTools: boolean | undefined;
5
+ includeAllTools: boolean | undefined;
4
6
  filters: Filter[];
5
7
  capabilities: ClientCapabilities;
6
8
  list: boolean;
package/options.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"OAEO,EAAa,MAAM,EAAE;OACrB,EAAE,kBAAkB,EAAE;AA0C7B,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,kBAAkB,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;CACf;AA+BD,wBAAgB,YAAY,IAAI,aAAa,CA6L5C"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"OAEO,EAAa,MAAM,EAAE;OACrB,EAAE,kBAAkB,EAAE;AA0C7B,MAAM,WAAW,aAAa;IAC5B,mBAAmB,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,kBAAkB,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;CACf;AA+BD,wBAAgB,YAAY,IAAI,aAAa,CAiN5C"}