File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ export interface CompletableDef<T extends ZodTypeAny = ZodTypeAny> {
1717 typeName : McpZodTypeKind . Completable ;
1818}
1919
20+ /**
21+ * A Zod schema that has been wrapped with completion capabilities.
22+ */
23+ export type CompletableSchema < T extends ZodTypeAny > = T & { _def : T [ '_def' ] & CompletableDef < T > } ;
24+
2025/**
2126 * Wraps a Zod type to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP.
2227 *
@@ -26,7 +31,7 @@ export interface CompletableDef<T extends ZodTypeAny = ZodTypeAny> {
2631export function completable < T extends ZodTypeAny > (
2732 schema : T ,
2833 complete : CompleteCallback < T >
29- ) : T & { _def : T [ '_def' ] & CompletableDef < T > } {
34+ ) : CompletableSchema < T > {
3035 // Create new schema object inheriting from original
3136 const wrapped = Object . create ( Object . getPrototypeOf ( schema ) ) ;
3237
@@ -62,5 +67,5 @@ export function completable<T extends ZodTypeAny>(
6267 def : newDef
6368 } ;
6469
65- return wrapped as T & { _def : T [ '_def' ] & CompletableDef < T > } ;
70+ return wrapped as CompletableSchema < T > ;
6671}
You can’t perform that action at this time.
0 commit comments