typespec-http-mcp 0.4.0 → 0.5.0

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.
@@ -45,9 +45,10 @@ function isMergeableBody(program, type) {
45
45
  if (type.indexer?.key?.name === "integer")
46
46
  return false;
47
47
  /**
48
- * A model carrying `@discriminator` is emitted as a UNION of its variants, not as an object --
49
- * measured: `z.discriminatedUnion("kind", [...])`, which has no shape. Which variant arrived is
50
- * decided by a value, so there is no single set of properties to merge into the arguments.
48
+ * A model carrying `@discriminator` is emitted as a UNION of its variants and itself, not as an
49
+ * object -- measured: `z.union([z.discriminatedUnion("kind", [...]), z.object(...)])`, which has
50
+ * no shape. Which arm a value takes is decided by the value, so there is no single set of
51
+ * properties to merge into the arguments.
51
52
  */
52
53
  if (getDiscriminator(program, type) !== undefined)
53
54
  return false;
@@ -125,9 +126,10 @@ export function refusalFor(program, route, operation) {
125
126
  */
126
127
  if (route.bodyProperty === undefined) {
127
128
  /**
128
- * **A body declared `void` or `never` is no body**, and the library lists no media type for
129
- * one; read that way, there is nothing to merge. Read off the operation, its intrinsic type is
130
- * not an object and the tool was refused as `non-object-body`.
129
+ * **A body declared `void` is no body**, and the library lists no media type for one; read
130
+ * that way, there is nothing to merge. Read off the operation, its intrinsic type is not an
131
+ * object and the tool was refused as `non-object-body`. A body declared `never` the library
132
+ * refuses, as `never-body`.
131
133
  */
132
134
  const body = types.length === 0 ? undefined : operation.parameters.body?.type;
133
135
  if (!isMergeableBody(program, body)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typespec-http-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "TypeSpec emitter: generate an MCP tool surface, and the Zod validators it publishes, from an HTTP service definition, dispatching into the same handlers a generated HTTP server calls.",
5
5
  "keywords": [
6
6
  "cloudflare-workers",
@@ -45,7 +45,7 @@
45
45
  "provenance": true
46
46
  },
47
47
  "dependencies": {
48
- "typespec-http-zod": "^0.30.0"
48
+ "typespec-http-zod": "^0.31.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@hono/zod-validator": "^0.9.1",
@@ -66,8 +66,9 @@
66
66
  "hono": "^4.13.7",
67
67
  "oxfmt": "^0.67.0",
68
68
  "oxlint": "^1.82.0",
69
+ "secure-json-parse": "4.1.1",
69
70
  "typescript": "~7.0.2",
70
- "typespec-hono": "0.27.0",
71
+ "typespec-hono": "0.28.0",
71
72
  "typespec-http-mcp": "link:.",
72
73
  "vitest": "^5.0.0",
73
74
  "wrangler": "^4.131.1",