@mablhq/mabl-cli 2.72.18 → 2.72.26

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.
@@ -11,9 +11,9 @@ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
11
11
  const tools_1 = __importDefault(require("./tools"));
12
12
  const constants_1 = require("../../constants");
13
13
  const createMablTestForCurrentWork_1 = require("./prompts/createMablTestForCurrentWork");
14
- const common_1 = require("./tools/common");
15
14
  const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
16
15
  const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
16
+ const zod_to_json_schema_1 = require("zod-to-json-schema");
17
17
  exports.command = 'start [options]';
18
18
  exports.describe = 'Start the MCP server';
19
19
  exports.builder = (yargs) => {
@@ -48,31 +48,18 @@ async function startServer(parsed) {
48
48
  },
49
49
  });
50
50
  server.setRequestHandler(types_js_1.ListToolsRequestSchema, () => ({
51
- tools: tools_1.default.map((tool) => {
52
- const inputSchema = tool.schema.inputSchema.safeParse({}).success
53
- ? { type: 'object', properties: {} }
54
- : {
55
- type: 'object',
56
- properties: Object.fromEntries(Object.entries(tool.schema.inputSchema.shape).map(([key, value]) => {
57
- const description = value._def.description;
58
- return [
59
- key,
60
- {
61
- type: 'string',
62
- description: description || '',
63
- },
64
- ];
65
- })),
66
- };
67
- return {
68
- name: tool.schema.name,
69
- description: tool.schema.description,
70
- inputSchema,
71
- ...(tool.schema.outputSchema
72
- ? { outputSchema: (0, common_1.zodSchemaToOpenApiSchema)(tool.schema.outputSchema) }
73
- : {}),
74
- };
75
- }),
51
+ tools: tools_1.default.map((tool) => ({
52
+ name: tool.schema.name,
53
+ description: tool.schema.description,
54
+ inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(tool.schema.inputSchema, {
55
+ strictUnions: true,
56
+ }),
57
+ outputSchema: tool.schema.outputSchema
58
+ ? (0, zod_to_json_schema_1.zodToJsonSchema)(tool.schema.outputSchema, {
59
+ strictUnions: true,
60
+ })
61
+ : undefined,
62
+ })),
76
63
  }));
77
64
  server.setRequestHandler(types_js_1.ListPromptsRequestSchema, () => ({
78
65
  prompts: [createMablTestForCurrentWork_1.createMablTestPrompt],
@@ -138,6 +125,8 @@ async function startServer(parsed) {
138
125
  const result = await tool.handle(args, mablApiClient, server, workspaceId);
139
126
  return {
140
127
  content: result.content,
128
+ structuredContent: result.structuredContent,
129
+ isError: result.isError,
141
130
  };
142
131
  }
143
132
  catch (error) {
@@ -1,74 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringToToolResult = stringToToolResult;
4
- exports.zodSchemaToOpenApiSchema = zodSchemaToOpenApiSchema;
5
- const zod_1 = require("zod");
6
4
  function stringToToolResult(value, isError = false) {
7
5
  return {
8
6
  content: [
9
7
  {
10
8
  type: 'text',
11
9
  text: value,
12
- isError,
13
10
  },
14
11
  ],
12
+ isError,
15
13
  };
16
14
  }
17
- function zodSchemaToOpenApiSchema(schema) {
18
- if (schema instanceof zod_1.z.ZodArray) {
19
- const element = schema.element;
20
- if (element instanceof zod_1.z.ZodObject) {
21
- const itemShape = element.shape;
22
- return {
23
- type: 'array',
24
- items: {
25
- type: 'object',
26
- properties: Object.fromEntries(Object.entries(itemShape).map(([key, value]) => {
27
- const description = value._def.description;
28
- return [
29
- key,
30
- {
31
- type: (() => {
32
- if (value instanceof zod_1.z.ZodString) {
33
- return 'string';
34
- }
35
- if (value instanceof zod_1.z.ZodNumber) {
36
- return 'number';
37
- }
38
- if (value instanceof zod_1.z.ZodBoolean) {
39
- return 'boolean';
40
- }
41
- if (value instanceof zod_1.z.ZodArray) {
42
- return 'array';
43
- }
44
- if (value instanceof zod_1.z.ZodObject) {
45
- return 'object';
46
- }
47
- return 'string';
48
- })(),
49
- description: description || '',
50
- },
51
- ];
52
- })),
53
- },
54
- };
55
- }
56
- }
57
- else if (schema instanceof zod_1.z.ZodObject) {
58
- const shape = schema.shape;
59
- return {
60
- type: 'object',
61
- properties: Object.fromEntries(Object.entries(shape).map(([key, value]) => {
62
- const description = value._def.description;
63
- return [
64
- key,
65
- {
66
- type: 'string',
67
- description: description || '',
68
- },
69
- ];
70
- })),
71
- };
72
- }
73
- return undefined;
74
- }