import { type CallableMessage, type DiagnosticReport, type JSONSchemaType, type Program, type TypeSpecLibrary } from "@typespec/compiler"; import { type EmitterOptions as HttpZodOptions } from "typespec-http-zod"; /** * Everything `typespec-http-zod` accepts, plus what an MCP tool surface needs on top. * * **DERIVED, never restated, and the distinction is load-bearing.** This emitter runs the whole of * `typespec-http-zod` and adds files beside its output; every option that package accepts has to * reach it. Written as a second literal list, an option added there would be rejected here as * unknown, or worse, accepted and silently dropped -- output that is wrong in a way no test of * either package would see. `test/options.test.ts` asserts the forwarding as a CLASS. * * **`runtime-module` is declared here only to be REFUSED** (`runtime-module-removed`). The library no * longer has the option, and a schema without the key would report only "must NOT have additional * properties", which tells a consumer upgrading from a version that documented the option neither why * nor what to do instead. */ export type EmitterOptions = HttpZodOptions & { /** Refused. See `runtime-module-removed`. */ "runtime-module"?: string; /** * Tags that mark an operation as a tool. Unset means every operation is one. * * **Union, not intersection.** OpenAPI tags are a flat set with no AND semantics, so "carries any * of these" is the only reading the published document supports. Read with `getAllTags`, which * includes tags inherited from the enclosing interface and namespace -- `getTags` returns only an * operation's own, so an operation inside a `@tag`-carrying interface would report none and be * silently dropped. */ "tool-tags"?: string[]; /** Tags that exclude an operation from the tool surface, even when `tool-tags` selected it. */ "exclude-tags"?: string[]; /** * Prepended to every tool name, verbatim -- the author owns the separator. * * The result is validated against MCP's name rule and REFUSED if it fails, never rewritten: an * operation id is a fact the document publishes, and re-spelling it invents a second name for * one thing. */ "tool-prefix"?: string; /** * Per-service overrides this emitter adds on top of the library's. * * **The library's own `services` map is preserved**, because the type is an intersection: an * option added there still arrives here, and this only widens what each entry may carry. */ services?: Record; }; declare const EmitterOptionsSchema: JSONSchemaType; /** * **Spelled out rather than inferred, and every type in it imported through THIS package's own * specifier.** Both this package and `typespec-http-zod` declare `@typespec/compiler` as a peer, so a * side-by-side checkout resolves two physically distinct copies of the identical version. TypeScript * then has a choice of which copy to name in the emitted declarations, and naming the other * package's produces `TS2883`, whose message is exactly the problem: *"this is likely not portable"*. * * A published `.d.ts` naming a `node_modules/.pnpm/...` path is broken for everyone who installed * differently. **A consumer never hits this**, because a peer dependency is installed once and both * packages share it -- which is precisely why it is worth guarding rather than trusting: the failure * exists only in the arrangement that BUILDS the package, and would ship silently. */ type Diagnostics = { "no-tools-selected": { readonly default: CallableMessage<["service", "configured", "available"]>; }; "unrepresentable-tool-name": { readonly default: CallableMessage<["name"]>; }; "tool-name-collision": { readonly default: CallableMessage<["first", "second", "name"]>; }; "shared-input-key": { readonly default: CallableMessage<["operationId", "types"]>; }; "binary-tool-input": { readonly default: CallableMessage<["operationId", "types"]>; }; "non-json-request": { readonly default: CallableMessage<["operationId", "types"]>; }; "non-object-body": { readonly default: CallableMessage<["operationId", "types"]>; }; "streamed-tool-output": { readonly default: CallableMessage<["operationId", "types"]>; }; "unvalidated-response-media-type": { readonly default: CallableMessage<["operationId", "status", "types"]>; }; "headers-only-success": { readonly default: CallableMessage<["operationId"]>; }; "tool-without-description": { readonly default: CallableMessage<["operationId"]>; }; "shared-output-dir": { readonly default: CallableMessage<["emitter", "differing"]>; }; "runtime-module-removed": { readonly default: CallableMessage<["value"]>; }; }; /** * This emitter's name, as `tspconfig.yaml`, the compiler and every diagnostic code all spell it. * * **One literal, because two would be a guard that stops working silently.** `coexistence.ts` looks * this emitter up in `program.compilerOptions.options` by name; a second copy that drifted would * find nothing and report no collision, with nothing to indicate the check had stopped running. */ export declare const PACKAGE_NAME = "typespec-http-mcp"; export declare const $lib: TypeSpecLibrary; export declare const reportDiagnostic: (program: Program, diagnostic: DiagnosticReport) => void; export { EmitterOptionsSchema };