@digipair/skill-mcp 0.117.0 → 0.117.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.
package/dist/index.cjs.js CHANGED
@@ -6,15 +6,18 @@ var streamableHttp_js = require('@modelcontextprotocol/sdk/server/streamableHttp
6
6
  var zod = require('zod');
7
7
 
8
8
  let MCPServerService = class MCPServerService {
9
- jsonSchemaToZod(schema) {
9
+ jsonSchemaToZod(schema, isRequired = false) {
10
10
  const zodProps = {};
11
11
  switch(schema.type){
12
12
  case 'string':
13
- return zod.z.string().optional();
13
+ if (schema.format === 'byte') {
14
+ return isRequired ? zod.z.string().base64url() : zod.z.string().base64url().optional();
15
+ }
16
+ return isRequired ? zod.z.string() : zod.z.string().optional();
14
17
  case 'number':
15
- return zod.z.number().optional();
18
+ return isRequired ? zod.z.number() : zod.z.number().optional();
16
19
  case 'boolean':
17
- return zod.z.boolean().optional();
20
+ return isRequired ? zod.z.boolean() : zod.z.boolean().optional();
18
21
  case 'object':
19
22
  for(const prop in schema.properties){
20
23
  zodProps[prop] = this.jsonSchemaToZod(schema.properties[prop]);
@@ -22,15 +25,18 @@ let MCPServerService = class MCPServerService {
22
25
  zodProps[prop] = zodProps[prop].describe(schema.properties[prop].description);
23
26
  }
24
27
  }
25
- return zod.z.object(zodProps).required((schema.required ?? []).reduce((acc, reqProp)=>({
28
+ return isRequired ? zod.z.object(zodProps).required((schema.required ?? []).reduce((acc, reqProp)=>({
29
+ ...acc,
30
+ [reqProp]: true
31
+ }), {})) : zod.z.object(zodProps).required((schema.required ?? []).reduce((acc, reqProp)=>({
26
32
  ...acc,
27
33
  [reqProp]: true
28
34
  }), {})).optional();
29
35
  case 'array':
30
36
  if (schema.items) {
31
- return zod.z.array(this.jsonSchemaToZod(schema.items)).optional();
37
+ return isRequired ? zod.z.array(this.jsonSchemaToZod(schema.items, true)) : zod.z.array(this.jsonSchemaToZod(schema.items, true)).optional();
32
38
  }
33
- return zod.z.array(zod.z.unknown()).optional();
39
+ return isRequired ? zod.z.array(zod.z.unknown()) : zod.z.array(zod.z.unknown()).optional();
34
40
  default:
35
41
  throw new Error(`Unsupported JSON Schema type: ${schema.type}`);
36
42
  }
@@ -47,15 +53,15 @@ let MCPServerService = class MCPServerService {
47
53
  let inputSchema;
48
54
  if (tool.inputSchema) {
49
55
  inputSchema = {};
50
- for(const prop in tool.inputSchema){
51
- inputSchema[prop] = this.jsonSchemaToZod(tool.inputSchema[prop]);
56
+ for(const prop in tool.inputSchema.properties){
57
+ inputSchema[prop] = this.jsonSchemaToZod(tool.inputSchema.properties[prop], tool.inputSchema.required?.includes(prop));
52
58
  }
53
59
  }
54
60
  let outputSchema;
55
61
  if (tool.outputSchema) {
56
62
  outputSchema = {};
57
- for(const prop in tool.outputSchema){
58
- outputSchema[prop] = this.jsonSchemaToZod(tool.outputSchema[prop]);
63
+ for(const prop in tool.outputSchema.properties){
64
+ outputSchema[prop] = this.jsonSchemaToZod(tool.outputSchema.properties[prop], tool.outputSchema.required?.includes(prop));
59
65
  }
60
66
  }
61
67
  server.registerTool(tool.name, {
package/dist/index.esm.js CHANGED
@@ -22843,14 +22843,14 @@ function indent(str, spaces) {
22843
22843
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
22844
22844
  // match is required
22845
22845
  if (!match) {
22846
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
22846
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
22847
22847
  v: nextMatch1
22848
22848
  };
22849
22849
  }
22850
22850
  var token = match.token, offset = match.offset;
22851
22851
  i1 += offset;
22852
22852
  if (token === ' ') {
22853
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
22853
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
22854
22854
  }
22855
22855
  tokens1 = _to_consumable_array$4$1(tokens1).concat([
22856
22856
  token
@@ -22869,7 +22869,7 @@ function indent(str, spaces) {
22869
22869
  if (contextKeys.some(function(el) {
22870
22870
  return el.startsWith(name);
22871
22871
  })) {
22872
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
22872
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
22873
22873
  }
22874
22874
  if (dateTimeIdentifiers.some(function(el) {
22875
22875
  return el === name;
@@ -22888,9 +22888,9 @@ function indent(str, spaces) {
22888
22888
  if (dateTimeIdentifiers.some(function(el) {
22889
22889
  return el.startsWith(name);
22890
22890
  })) {
22891
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
22891
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
22892
22892
  }
22893
- return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
22893
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
22894
22894
  v: nextMatch1
22895
22895
  };
22896
22896
  };
@@ -77888,15 +77888,18 @@ var MAXIMUM_MESSAGE_SIZE = '4mb';
77888
77888
  ();
77889
77889
 
77890
77890
  let MCPServerService = class MCPServerService {
77891
- jsonSchemaToZod(schema) {
77891
+ jsonSchemaToZod(schema, isRequired = false) {
77892
77892
  const zodProps = {};
77893
77893
  switch(schema.type){
77894
77894
  case 'string':
77895
- return stringType().optional();
77895
+ if (schema.format === 'byte') {
77896
+ return isRequired ? stringType().base64url() : stringType().base64url().optional();
77897
+ }
77898
+ return isRequired ? stringType() : stringType().optional();
77896
77899
  case 'number':
77897
- return numberType().optional();
77900
+ return isRequired ? numberType() : numberType().optional();
77898
77901
  case 'boolean':
77899
- return booleanType().optional();
77902
+ return isRequired ? booleanType() : booleanType().optional();
77900
77903
  case 'object':
77901
77904
  for(const prop in schema.properties){
77902
77905
  zodProps[prop] = this.jsonSchemaToZod(schema.properties[prop]);
@@ -77904,15 +77907,18 @@ let MCPServerService = class MCPServerService {
77904
77907
  zodProps[prop] = zodProps[prop].describe(schema.properties[prop].description);
77905
77908
  }
77906
77909
  }
77907
- return objectType(zodProps).required((schema.required ?? []).reduce((acc, reqProp)=>({
77910
+ return isRequired ? objectType(zodProps).required((schema.required ?? []).reduce((acc, reqProp)=>({
77911
+ ...acc,
77912
+ [reqProp]: true
77913
+ }), {})) : objectType(zodProps).required((schema.required ?? []).reduce((acc, reqProp)=>({
77908
77914
  ...acc,
77909
77915
  [reqProp]: true
77910
77916
  }), {})).optional();
77911
77917
  case 'array':
77912
77918
  if (schema.items) {
77913
- return arrayType(this.jsonSchemaToZod(schema.items)).optional();
77919
+ return isRequired ? arrayType(this.jsonSchemaToZod(schema.items, true)) : arrayType(this.jsonSchemaToZod(schema.items, true)).optional();
77914
77920
  }
77915
- return arrayType(unknownType()).optional();
77921
+ return isRequired ? arrayType(unknownType()) : arrayType(unknownType()).optional();
77916
77922
  default:
77917
77923
  throw new Error(`Unsupported JSON Schema type: ${schema.type}`);
77918
77924
  }
@@ -77929,15 +77935,15 @@ let MCPServerService = class MCPServerService {
77929
77935
  let inputSchema;
77930
77936
  if (tool.inputSchema) {
77931
77937
  inputSchema = {};
77932
- for(const prop in tool.inputSchema){
77933
- inputSchema[prop] = this.jsonSchemaToZod(tool.inputSchema[prop]);
77938
+ for(const prop in tool.inputSchema.properties){
77939
+ inputSchema[prop] = this.jsonSchemaToZod(tool.inputSchema.properties[prop], tool.inputSchema.required?.includes(prop));
77934
77940
  }
77935
77941
  }
77936
77942
  let outputSchema;
77937
77943
  if (tool.outputSchema) {
77938
77944
  outputSchema = {};
77939
- for(const prop in tool.outputSchema){
77940
- outputSchema[prop] = this.jsonSchemaToZod(tool.outputSchema[prop]);
77945
+ for(const prop in tool.outputSchema.properties){
77946
+ outputSchema[prop] = this.jsonSchemaToZod(tool.outputSchema.properties[prop], tool.outputSchema.required?.includes(prop));
77941
77947
  }
77942
77948
  }
77943
77949
  server.registerTool(tool.name, {
@@ -1 +1 @@
1
- {"version":3,"file":"skill-mcp.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-mcp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0GjE,eAAO,MAAM,YAAY,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,kBACtB,CAAC"}
1
+ {"version":3,"file":"skill-mcp.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-mcp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA8HjE,eAAO,MAAM,YAAY,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,kBACtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-mcp",
3
- "version": "0.117.0",
3
+ "version": "0.117.1",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",