typespec-http-mcp 0.8.0 → 0.8.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/README.md CHANGED
@@ -135,10 +135,6 @@ cannot publish, so the emitted surface would enforce a rule no reader of the con
135
135
  - [`docs/releasing.md`](docs/releasing.md) -- the local-registry rehearsal and the proof this package passed.
136
136
  - [`docs/measurements.md`](docs/measurements.md) -- the probes the design rests on.
137
137
 
138
- ## Working record
139
-
140
- [`HANDOVER.md`](HANDOVER.md) -- state, the traps, and what is open.
141
-
142
138
  ## Licence
143
139
 
144
140
  MIT.
@@ -216,8 +216,8 @@ export async function $onEmit(context) {
216
216
  }
217
217
  /**
218
218
  * **`emitted + refused === selected`, asserted from structured counts rather than by reading
219
- * the file back.** Deciding anything by pattern-matching emitted text is how this estate
220
- * acquired a class of defect it then had to hunt for.
219
+ * the file back.** Deciding anything by pattern-matching emitted text invites a class of defect
220
+ * that then has to be hunted for.
221
221
  */
222
222
  if (entries.length + refused !== selection.selected.length) {
223
223
  throw new Error(`typespec-http-mcp internal invariant: ${entries.length} emitted + ${refused} refused ` +
package/dist/src/lib.js CHANGED
@@ -134,10 +134,9 @@ const diagnostics = {
134
134
  * A tool's arguments are the path, query, header and cookie groups spread into one object, the
135
135
  * body merged or named beside them - the same input a server's handler receives. `@header("x")`
136
136
  * beside `@query("x")` therefore published one `x` argument, the later group's schema replacing
137
- * the earlier, and the handler was handed one value for two declarations (typespec-http-graphql,
138
- * 2026-10-16). `typespec-http-zod` names the pair in `EmittedRoute.sharedInputKeys` and reports it
139
- * as its own `shared-input-key`; this is the tool surface declining it, as `typespec-hono` declines
140
- * to mount it.
137
+ * the earlier, and the handler was handed one value for two declarations. `typespec-http-zod`
138
+ * names the pair in `EmittedRoute.sharedInputKeys` and reports it as its own `shared-input-key`;
139
+ * this is the tool surface declining it, as `typespec-hono` declines to mount it.
141
140
  */
142
141
  "shared-input-key": {
143
142
  severity: "warning",
@@ -23,7 +23,7 @@ export type Refusal = {
23
23
  * **Not a refusal: a reserved-expansion path parameter.** That is a ROUTING fact -- it decides how a
24
24
  * router matches a URL. MCP has no URI template, and the handler receives the same string either
25
25
  * way. The sibling server emitter refuses it and should; that the two emitters have different
26
- * refusal sets from one intermediate representation is the split working, not a gap.
26
+ * refusal sets from one intermediate representation is by design, not a gap.
27
27
  */
28
28
  export declare function refusalFor(program: Program, route: EmittedRoute, operation: HttpOperation): Refusal | undefined;
29
29
  /** A quality warning, with what its message names. */
@@ -75,7 +75,7 @@ function isMergeableBody(program, type) {
75
75
  * **Not a refusal: a reserved-expansion path parameter.** That is a ROUTING fact -- it decides how a
76
76
  * router matches a URL. MCP has no URI template, and the handler receives the same string either
77
77
  * way. The sibling server emitter refuses it and should; that the two emitters have different
78
- * refusal sets from one intermediate representation is the split working, not a gap.
78
+ * refusal sets from one intermediate representation is by design, not a gap.
79
79
  */
80
80
  export function refusalFor(program, route, operation) {
81
81
  const types = route.requestContentTypes;
@@ -138,10 +138,10 @@ export declare class UndeclaredStatusError extends Error {
138
138
  * **A stream of bytes, as every platform's `ReadableStream<Uint8Array>` satisfies it.**
139
139
  *
140
140
  * The same structural type `typespec-http-zod` publishes in `requests.gen.ts` and `typespec-hono`
141
- * declares in its runtime, so a backend whose result is typed by the framework-free contract can be
142
- * returned from a handler as it is. Declared here rather than imported because this file is copied
143
- * into a consumer's Worker, where the emitter packages are not installed; the agreement test holds
144
- * the declarations identical.
141
+ * declares in its runtime, so a value typed by the framework-free contract can be returned from a
142
+ * handler as it is. Declared here rather than imported because this file is copied into a
143
+ * consumer's Worker, where the emitter packages are not installed; the agreement test holds the
144
+ * declarations identical.
145
145
  */
146
146
  export interface ByteStream {
147
147
  getReader(): {
@@ -112,8 +112,8 @@ function refusedBody(input, message) {
112
112
  *
113
113
  * A stream is buffered: a tool result is one message, and the block carries the whole of it. It is
114
114
  * read through its reader, which is all `ByteStream` promises, so a stream that is not the platform's
115
- * - a contract value from a backend, a test double - is read the same way. A value that is not a
116
- * `Uint8Array` is not a byte, and refuses the body rather than being coerced.
115
+ * - a contract value, a test double - is read the same way. A value that is not a `Uint8Array` is
116
+ * not a byte, and refuses the body rather than being coerced.
117
117
  */
118
118
  async function bytesOf(body) {
119
119
  if (body instanceof Uint8Array)
@@ -16,8 +16,8 @@ import type { EmittedRoute } from "typespec-http-zod";
16
16
  *
17
17
  * where `/bulk` is a member of a tagged interface. Tagging a whole interface is the obvious way to
18
18
  * mark a group of operations as tools, so `getTags` would break the primary use case invisibly --
19
- * the same failure shape this estate already recorded for matching operations by NAME, which never
20
- * succeeded for an operation inside an `interface`.
19
+ * the same failure shape as matching operations by NAME, which never succeeds for an operation
20
+ * inside an `interface`.
21
21
  *
22
22
  * **A `@tag` on the service namespace propagates to every operation.** That is correct and
23
23
  * documented: it is how a whole service is marked, and it is also why a tag chosen for grouping and
package/dist/src/tools.js CHANGED
@@ -246,9 +246,9 @@ function resultTypeOf(entry) {
246
246
  break;
247
247
  case "binary":
248
248
  /**
249
- * **`ByteStream`, not `ReadableStream`, so a backend's contract value fits**, as the sibling
250
- * server types it. The contract types state a binary body structurally, because they cannot
251
- * name the platform stream; a platform stream still satisfies it.
249
+ * **`ByteStream`, not `ReadableStream`, so a value typed by the contract types fits**, as
250
+ * the sibling server types it. The contract types state a binary body structurally, because
251
+ * they cannot name the platform stream; a platform stream still satisfies it.
252
252
  */
253
253
  fields.push("readonly body: ByteStream | Uint8Array<ArrayBuffer> | ArrayBuffer");
254
254
  break;
@@ -326,7 +326,7 @@ function isSuccessStatus(status) {
326
326
  function inputSchemaName(entry) {
327
327
  return `${entry.route.operationId}Input`;
328
328
  }
329
- /** The banner every generated file in this estate carries. */
329
+ /** The banner every file this emitter generates carries. */
330
330
  function generatedBanner(hint) {
331
331
  const second = hint === undefined
332
332
  ? "// Recompile the spec that produced it; edits here are overwritten on the next run."
@@ -379,8 +379,8 @@ export function renderTools(entries, declaredOperationIds, options) {
379
379
  : `import { ${[...imported].toSorted().join(", ")} } from "./schemas.gen.js";\n`;
380
380
  /**
381
381
  * Which helpers any signature actually needs. Read from the IR rather than from the rendered
382
- * text: deciding anything by pattern-matching emitted output is the defect class this estate
383
- * exists to remove.
382
+ * text: deciding anything by pattern-matching emitted output invites a class of defect that then
383
+ * has to be hunted for.
384
384
  */
385
385
  const usesFields = entries.some((entry) => intersectedValidators(entry).length > 0);
386
386
  const usesProduced = entries.some((entry) => membersOf(entry.route, entry.names).some((member) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typespec-http-mcp",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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",
package/src/runtime.ts CHANGED
@@ -221,10 +221,10 @@ function refusedBody(input: unknown, message: string): ZodError["issues"] {
221
221
  * **A stream of bytes, as every platform's `ReadableStream<Uint8Array>` satisfies it.**
222
222
  *
223
223
  * The same structural type `typespec-http-zod` publishes in `requests.gen.ts` and `typespec-hono`
224
- * declares in its runtime, so a backend whose result is typed by the framework-free contract can be
225
- * returned from a handler as it is. Declared here rather than imported because this file is copied
226
- * into a consumer's Worker, where the emitter packages are not installed; the agreement test holds
227
- * the declarations identical.
224
+ * declares in its runtime, so a value typed by the framework-free contract can be returned from a
225
+ * handler as it is. Declared here rather than imported because this file is copied into a
226
+ * consumer's Worker, where the emitter packages are not installed; the agreement test holds the
227
+ * declarations identical.
228
228
  */
229
229
  export interface ByteStream {
230
230
  getReader(): {
@@ -239,8 +239,8 @@ export interface ByteStream {
239
239
  *
240
240
  * A stream is buffered: a tool result is one message, and the block carries the whole of it. It is
241
241
  * read through its reader, which is all `ByteStream` promises, so a stream that is not the platform's
242
- * - a contract value from a backend, a test double - is read the same way. A value that is not a
243
- * `Uint8Array` is not a byte, and refuses the body rather than being coerced.
242
+ * - a contract value, a test double - is read the same way. A value that is not a `Uint8Array` is
243
+ * not a byte, and refuses the body rather than being coerced.
244
244
  */
245
245
  async function bytesOf(body: unknown): Promise<Uint8Array | undefined> {
246
246
  if (body instanceof Uint8Array) return body;