@settlemint/sdk-mcp 2.3.0-prf3dfe6b5 → 2.3.0-prfa205dcb

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.
package/dist/mcp.js CHANGED
@@ -53834,14 +53834,8 @@ var ToolSchema = z.object({
53834
53834
  description: z.optional(z.string()),
53835
53835
  inputSchema: z.object({
53836
53836
  type: z.literal("object"),
53837
- properties: z.optional(z.object({}).passthrough()),
53838
- required: z.optional(z.array(z.string()))
53837
+ properties: z.optional(z.object({}).passthrough())
53839
53838
  }).passthrough(),
53840
- outputSchema: z.optional(z.object({
53841
- type: z.literal("object"),
53842
- properties: z.optional(z.object({}).passthrough()),
53843
- required: z.optional(z.array(z.string()))
53844
- }).passthrough()),
53845
53839
  annotations: z.optional(ToolAnnotationsSchema)
53846
53840
  }).passthrough();
53847
53841
  var ListToolsRequestSchema = PaginatedRequestSchema.extend({
@@ -53850,26 +53844,10 @@ var ListToolsRequestSchema = PaginatedRequestSchema.extend({
53850
53844
  var ListToolsResultSchema = PaginatedResultSchema.extend({
53851
53845
  tools: z.array(ToolSchema)
53852
53846
  });
53853
- var ContentListSchema = z.array(z.union([
53854
- TextContentSchema,
53855
- ImageContentSchema,
53856
- AudioContentSchema,
53857
- EmbeddedResourceSchema
53858
- ]));
53859
- var CallToolUnstructuredResultSchema = ResultSchema.extend({
53860
- content: ContentListSchema,
53861
- structuredContent: z.never().optional(),
53862
- isError: z.optional(z.boolean())
53847
+ var CallToolResultSchema = ResultSchema.extend({
53848
+ content: z.array(z.union([TextContentSchema, ImageContentSchema, AudioContentSchema, EmbeddedResourceSchema])),
53849
+ isError: z.boolean().default(false).optional()
53863
53850
  });
53864
- var CallToolStructuredResultSchema = ResultSchema.extend({
53865
- structuredContent: z.object({}).passthrough(),
53866
- content: z.optional(ContentListSchema),
53867
- isError: z.optional(z.boolean())
53868
- });
53869
- var CallToolResultSchema = z.union([
53870
- CallToolUnstructuredResultSchema,
53871
- CallToolStructuredResultSchema
53872
- ]);
53873
53851
  var CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
53874
53852
  toolResult: z.unknown()
53875
53853
  }));
@@ -55788,7 +55766,7 @@ class McpServer {
55788
55766
  });
55789
55767
  this.server.setRequestHandler(ListToolsRequestSchema, () => ({
55790
55768
  tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name, tool]) => {
55791
- const toolDefinition = {
55769
+ return {
55792
55770
  name,
55793
55771
  description: tool.description,
55794
55772
  inputSchema: tool.inputSchema ? zodToJsonSchema(tool.inputSchema, {
@@ -55796,10 +55774,6 @@ class McpServer {
55796
55774
  }) : EMPTY_OBJECT_JSON_SCHEMA,
55797
55775
  annotations: tool.annotations
55798
55776
  };
55799
- if (tool.outputSchema) {
55800
- toolDefinition.outputSchema = zodToJsonSchema(tool.outputSchema, { strictUnions: true });
55801
- }
55802
- return toolDefinition;
55803
55777
  })
55804
55778
  }));
55805
55779
  this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
@@ -55810,7 +55784,6 @@ class McpServer {
55810
55784
  if (!tool.enabled) {
55811
55785
  throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);
55812
55786
  }
55813
- let result;
55814
55787
  if (tool.inputSchema) {
55815
55788
  const parseResult = await tool.inputSchema.safeParseAsync(request.params.arguments);
55816
55789
  if (!parseResult.success) {
@@ -55819,9 +55792,9 @@ class McpServer {
55819
55792
  const args = parseResult.data;
55820
55793
  const cb = tool.callback;
55821
55794
  try {
55822
- result = await Promise.resolve(cb(args, extra));
55795
+ return await Promise.resolve(cb(args, extra));
55823
55796
  } catch (error) {
55824
- result = {
55797
+ return {
55825
55798
  content: [
55826
55799
  {
55827
55800
  type: "text",
@@ -55834,9 +55807,9 @@ class McpServer {
55834
55807
  } else {
55835
55808
  const cb = tool.callback;
55836
55809
  try {
55837
- result = await Promise.resolve(cb(extra));
55810
+ return await Promise.resolve(cb(extra));
55838
55811
  } catch (error) {
55839
- result = {
55812
+ return {
55840
55813
  content: [
55841
55814
  {
55842
55815
  type: "text",
@@ -55847,27 +55820,6 @@ class McpServer {
55847
55820
  };
55848
55821
  }
55849
55822
  }
55850
- if (tool.outputSchema) {
55851
- if (!result.structuredContent && !result.isError) {
55852
- throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has outputSchema but returned no structuredContent`);
55853
- }
55854
- if (result.structuredContent && !result.content) {
55855
- result.content = [
55856
- {
55857
- type: "text",
55858
- text: JSON.stringify(result.structuredContent, null, 2)
55859
- }
55860
- ];
55861
- }
55862
- } else {
55863
- if (!result.content && !result.isError) {
55864
- throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has no outputSchema and must return content`);
55865
- }
55866
- if (result.structuredContent) {
55867
- throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has no outputSchema but returned structuredContent`);
55868
- }
55869
- }
55870
- return result;
55871
55823
  });
55872
55824
  this._toolHandlersInitialized = true;
55873
55825
  }
@@ -56101,13 +56053,33 @@ class McpServer {
56101
56053
  return registeredResourceTemplate;
56102
56054
  }
56103
56055
  }
56104
- _createRegisteredTool(name, description, inputSchema, outputSchema, annotations, callback) {
56056
+ tool(name, ...rest) {
56057
+ if (this._registeredTools[name]) {
56058
+ throw new Error(`Tool ${name} is already registered`);
56059
+ }
56060
+ let description;
56061
+ if (typeof rest[0] === "string") {
56062
+ description = rest.shift();
56063
+ }
56064
+ let paramsSchema;
56065
+ let annotations;
56066
+ if (rest.length > 1) {
56067
+ const firstArg = rest[0];
56068
+ if (isZodRawShape(firstArg)) {
56069
+ paramsSchema = rest.shift();
56070
+ if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShape(rest[0])) {
56071
+ annotations = rest.shift();
56072
+ }
56073
+ } else if (typeof firstArg === "object" && firstArg !== null) {
56074
+ annotations = rest.shift();
56075
+ }
56076
+ }
56077
+ const cb = rest[0];
56105
56078
  const registeredTool = {
56106
56079
  description,
56107
- inputSchema: inputSchema === undefined ? undefined : z.object(inputSchema),
56108
- outputSchema: outputSchema === undefined ? undefined : z.object(outputSchema),
56080
+ inputSchema: paramsSchema === undefined ? undefined : z.object(paramsSchema),
56109
56081
  annotations,
56110
- callback,
56082
+ callback: cb,
56111
56083
  enabled: true,
56112
56084
  disable: () => registeredTool.update({ enabled: false }),
56113
56085
  enable: () => registeredTool.update({ enabled: true }),
@@ -56136,38 +56108,6 @@ class McpServer {
56136
56108
  this.sendToolListChanged();
56137
56109
  return registeredTool;
56138
56110
  }
56139
- tool(name, ...rest) {
56140
- if (this._registeredTools[name]) {
56141
- throw new Error(`Tool ${name} is already registered`);
56142
- }
56143
- let description;
56144
- let inputSchema;
56145
- let outputSchema;
56146
- let annotations;
56147
- if (typeof rest[0] === "string") {
56148
- description = rest.shift();
56149
- }
56150
- if (rest.length > 1) {
56151
- const firstArg = rest[0];
56152
- if (isZodRawShape(firstArg)) {
56153
- inputSchema = rest.shift();
56154
- if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShape(rest[0])) {
56155
- annotations = rest.shift();
56156
- }
56157
- } else if (typeof firstArg === "object" && firstArg !== null) {
56158
- annotations = rest.shift();
56159
- }
56160
- }
56161
- const callback = rest[0];
56162
- return this._createRegisteredTool(name, description, inputSchema, outputSchema, annotations, callback);
56163
- }
56164
- registerTool(name, config, cb) {
56165
- if (this._registeredTools[name]) {
56166
- throw new Error(`Tool ${name} is already registered`);
56167
- }
56168
- const { description, inputSchema, outputSchema, annotations } = config;
56169
- return this._createRegisteredTool(name, description, inputSchema, outputSchema, annotations, cb);
56170
- }
56171
56111
  prompt(name, ...rest) {
56172
56112
  if (this._registeredPrompts[name]) {
56173
56113
  throw new Error(`Prompt ${name} is already registered`);
@@ -61934,7 +61874,7 @@ var {
61934
61874
  var package_default = {
61935
61875
  name: "@settlemint/sdk-mcp",
61936
61876
  description: "MCP interface for SettleMint SDK, providing development tools and project management capabilities",
61937
- version: "2.3.0-prf3dfe6b5",
61877
+ version: "2.3.0-prfa205dcb",
61938
61878
  type: "module",
61939
61879
  private: false,
61940
61880
  license: "FSL-1.1-MIT",
@@ -61975,9 +61915,9 @@ var package_default = {
61975
61915
  dependencies: {
61976
61916
  "@graphql-tools/load": "8.1.0",
61977
61917
  "@graphql-tools/url-loader": "8.0.31",
61978
- "@modelcontextprotocol/sdk": "1.11.4",
61979
- "@settlemint/sdk-js": "2.3.0-prf3dfe6b5",
61980
- "@settlemint/sdk-utils": "2.3.0-prf3dfe6b5",
61918
+ "@modelcontextprotocol/sdk": "1.11.3",
61919
+ "@settlemint/sdk-js": "2.3.0-prfa205dcb",
61920
+ "@settlemint/sdk-utils": "2.3.0-prfa205dcb",
61981
61921
  "@commander-js/extra-typings": "11.1.0",
61982
61922
  commander: "11.1.0",
61983
61923
  zod: "3.24.4"
@@ -67747,4 +67687,4 @@ await main().catch((error2) => {
67747
67687
  process.exit(1);
67748
67688
  });
67749
67689
 
67750
- //# debugId=BD50EE9BFF484F5364756E2164756E21
67690
+ //# debugId=D107FD8BD6DF17B764756E2164756E21