Merge pull request #23 from modelcontextprotocol/justin/add-missing-passthroughs
Make most object types pass through unrecognized properties
This commit is contained in:
commit
9158f53e2d
10 changed files with 10740 additions and 6159 deletions
1
dist/server/index.d.ts
generated
vendored
1
dist/server/index.d.ts
generated
vendored
|
|
@ -26,7 +26,6 @@ export declare class Server extends Protocol<ServerRequest, ServerNotification,
|
|||
* After initialization has completed, this will be populated with information about the client's name and version.
|
||||
*/
|
||||
getClientVersion(): Implementation | undefined;
|
||||
private getCapability;
|
||||
private getCapabilities;
|
||||
}
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
2
dist/server/index.d.ts.map
generated
vendored
2
dist/server/index.d.ts.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAElB,cAAc,EAMd,kBAAkB,EAClB,aAAa,EACb,YAAY,EAMb,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ,CAClC,aAAa,EACb,kBAAkB,EAClB,YAAY,CACb;IAYa,OAAO,CAAC,WAAW;IAX/B,OAAO,CAAC,mBAAmB,CAAC,CAAqB;IACjD,OAAO,CAAC,cAAc,CAAC,CAAiB;IAExC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B;;OAEG;gBACiB,WAAW,EAAE,cAAc;YAWjC,aAAa;IAmB3B;;OAEG;IACH,qBAAqB,IAAI,kBAAkB,GAAG,SAAS;IAIvD;;OAEG;IACH,gBAAgB,IAAI,cAAc,GAAG,SAAS;IAI9C,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,eAAe;CAUxB"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,cAAc,EAMd,kBAAkB,EAClB,aAAa,EACb,YAAY,EAMb,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ,CAClC,aAAa,EACb,kBAAkB,EAClB,YAAY,CACb;IAYa,OAAO,CAAC,WAAW;IAX/B,OAAO,CAAC,mBAAmB,CAAC,CAAqB;IACjD,OAAO,CAAC,cAAc,CAAC,CAAiB;IAExC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B;;OAEG;gBACiB,WAAW,EAAE,cAAc;YAWjC,aAAa;IAmB3B;;OAEG;IACH,qBAAqB,IAAI,kBAAkB,GAAG,SAAS;IAIvD;;OAEG;IACH,gBAAgB,IAAI,cAAc,GAAG,SAAS;IAI9C,OAAO,CAAC,eAAe;CAwBxB"}
|
||||
19
dist/server/index.js
generated
vendored
19
dist/server/index.js
generated
vendored
|
|
@ -39,15 +39,20 @@ export class Server extends Protocol {
|
|||
getClientVersion() {
|
||||
return this._clientVersion;
|
||||
}
|
||||
getCapability(reqType) {
|
||||
return this._requestHandlers.has(reqType) ? {} : undefined;
|
||||
}
|
||||
getCapabilities() {
|
||||
return {
|
||||
prompts: this.getCapability(ListPromptsRequestSchema.shape.method.value),
|
||||
resources: this.getCapability(ListResourcesRequestSchema.shape.method.value),
|
||||
tools: this.getCapability(ListToolsRequestSchema.shape.method.value),
|
||||
logging: this.getCapability(SetLevelRequestSchema.shape.method.value),
|
||||
prompts: this._requestHandlers.has(ListPromptsRequestSchema.shape.method.value)
|
||||
? {}
|
||||
: undefined,
|
||||
resources: this._requestHandlers.has(ListResourcesRequestSchema.shape.method.value)
|
||||
? {}
|
||||
: undefined,
|
||||
tools: this._requestHandlers.has(ListToolsRequestSchema.shape.method.value)
|
||||
? {}
|
||||
: undefined,
|
||||
logging: this._requestHandlers.has(SetLevelRequestSchema.shape.method.value)
|
||||
? {}
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
dist/server/index.js.map
generated
vendored
2
dist/server/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAIL,6BAA6B,EAE7B,uBAAuB,EAEvB,gBAAgB,EAKhB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,QAI3B;IASC;;OAEG;IACH,YAAoB,WAA2B;QAC7C,KAAK,EAAE,CAAC;QADU,gBAAW,GAAX,WAAW,CAAgB;QAG7C,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,CAC1D,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAC5B,CAAC;QACF,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,EAAE,GAAG,EAAE,WAC9D,OAAA,MAAA,IAAI,CAAC,aAAa,oDAAI,CAAA,EAAA,CACvB,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,aAAa,CACzB,OAA0B;QAE1B,IAAI,OAAO,CAAC,MAAM,CAAC,eAAe,KAAK,gBAAgB,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CACb,+CAA+C,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,CAChF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;QACvD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;QAEhD,OAAO;YACL,eAAe,EAAE,gBAAgB;YACjC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEO,aAAa,CACnB,OAAgC;QAEhC,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,CAAC;IAEO,eAAe;QACrB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YACxE,SAAS,EAAE,IAAI,CAAC,aAAa,CAC3B,0BAA0B,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAC9C;YACD,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YACpE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;SACtE,CAAC;IACJ,CAAC;CACF"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAGL,6BAA6B,EAE7B,uBAAuB,EAEvB,gBAAgB,EAKhB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,QAI3B;IASC;;OAEG;IACH,YAAoB,WAA2B;QAC7C,KAAK,EAAE,CAAC;QADU,gBAAW,GAAX,WAAW,CAAgB;QAG7C,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,CAC1D,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAC5B,CAAC;QACF,IAAI,CAAC,sBAAsB,CAAC,6BAA6B,EAAE,GAAG,EAAE,WAC9D,OAAA,MAAA,IAAI,CAAC,aAAa,oDAAI,CAAA,EAAA,CACvB,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,aAAa,CACzB,OAA0B;QAE1B,IAAI,OAAO,CAAC,MAAM,CAAC,eAAe,KAAK,gBAAgB,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CACb,+CAA+C,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,CAChF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;QACvD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;QAEhD,OAAO;YACL,eAAe,EAAE,gBAAgB;YACjC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEO,eAAe;QACrB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAChC,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAe,CACtD;gBACC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,SAAS;YACb,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAClC,0BAA0B,CAAC,KAAK,CAAC,MAAM,CAAC,KAAe,CACxD;gBACC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,SAAS;YACb,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAC9B,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAe,CACpD;gBACC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,SAAS;YACb,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAChC,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAe,CACnD;gBACC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;CACF"}
|
||||
8154
dist/types.d.ts
generated
vendored
8154
dist/types.d.ts
generated
vendored
File diff suppressed because it is too large
Load diff
2
dist/types.d.ts.map
generated
vendored
2
dist/types.d.ts.map
generated
vendored
File diff suppressed because one or more lines are too long
120
dist/types.js
generated
vendored
120
dist/types.js
generated
vendored
|
|
@ -130,17 +130,20 @@ export const EmptyResultSchema = ResultSchema.strict();
|
|||
/**
|
||||
* Text provided to or from an LLM.
|
||||
*/
|
||||
export const TextContentSchema = z.object({
|
||||
export const TextContentSchema = z
|
||||
.object({
|
||||
type: z.literal("text"),
|
||||
/**
|
||||
* The text content of the message.
|
||||
*/
|
||||
text: z.string(),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* An image provided to or from an LLM.
|
||||
*/
|
||||
export const ImageContentSchema = z.object({
|
||||
export const ImageContentSchema = z
|
||||
.object({
|
||||
type: z.literal("image"),
|
||||
/**
|
||||
* The base64-encoded image data.
|
||||
|
|
@ -150,25 +153,31 @@ export const ImageContentSchema = z.object({
|
|||
* The MIME type of the image. Different providers may support different image types.
|
||||
*/
|
||||
mimeType: z.string(),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* Describes a message issued to or received from an LLM API.
|
||||
*/
|
||||
export const SamplingMessageSchema = z.object({
|
||||
export const SamplingMessageSchema = z
|
||||
.object({
|
||||
role: z.enum(["user", "assistant"]),
|
||||
content: z.union([TextContentSchema, ImageContentSchema]),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* Describes the name and version of an MCP implementation.
|
||||
*/
|
||||
export const ImplementationSchema = z.object({
|
||||
export const ImplementationSchema = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
version: z.string(),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
|
||||
*/
|
||||
export const ClientCapabilitiesSchema = z.object({
|
||||
export const ClientCapabilitiesSchema = z
|
||||
.object({
|
||||
/**
|
||||
* Experimental, non-standard capabilities that the client supports.
|
||||
*/
|
||||
|
|
@ -177,7 +186,8 @@ export const ClientCapabilitiesSchema = z.object({
|
|||
* Present if the client supports sampling from an LLM.
|
||||
*/
|
||||
sampling: z.optional(z.object({}).passthrough()),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* This request is sent from the client to the server when it first connects, asking it to begin initialization.
|
||||
*/
|
||||
|
|
@ -195,7 +205,8 @@ export const InitializeRequestSchema = RequestSchema.extend({
|
|||
/**
|
||||
* Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
|
||||
*/
|
||||
export const ServerCapabilitiesSchema = z.object({
|
||||
export const ServerCapabilitiesSchema = z
|
||||
.object({
|
||||
/**
|
||||
* Experimental, non-standard capabilities that the server supports.
|
||||
*/
|
||||
|
|
@ -241,7 +252,8 @@ export const ServerCapabilitiesSchema = z.object({
|
|||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough()),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* After receiving an initialize request from the client, the server sends this response.
|
||||
*/
|
||||
|
|
@ -267,7 +279,8 @@ export const PingRequestSchema = RequestSchema.extend({
|
|||
method: z.literal("ping"),
|
||||
});
|
||||
/* Progress notifications */
|
||||
export const ProgressSchema = z.object({
|
||||
export const ProgressSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The progress thus far. This should increase every time progress is made, even if the total is unknown.
|
||||
*/
|
||||
|
|
@ -276,7 +289,8 @@ export const ProgressSchema = z.object({
|
|||
* Total number of items to process (or total progress required), if known.
|
||||
*/
|
||||
total: z.optional(z.number()),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* An out-of-band notification used to inform the receiver of a progress update for a long-running request.
|
||||
*/
|
||||
|
|
@ -310,7 +324,8 @@ export const PaginatedResultSchema = ResultSchema.extend({
|
|||
/**
|
||||
* The contents of a specific resource or sub-resource.
|
||||
*/
|
||||
export const ResourceContentsSchema = z.object({
|
||||
export const ResourceContentsSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
|
|
@ -319,7 +334,8 @@ export const ResourceContentsSchema = z.object({
|
|||
* The MIME type of this resource, if known.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
export const TextResourceContentsSchema = ResourceContentsSchema.extend({
|
||||
/**
|
||||
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
||||
|
|
@ -335,7 +351,8 @@ export const BlobResourceContentsSchema = ResourceContentsSchema.extend({
|
|||
/**
|
||||
* A known resource that the server is capable of reading.
|
||||
*/
|
||||
export const ResourceSchema = z.object({
|
||||
export const ResourceSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
|
|
@ -356,11 +373,13 @@ export const ResourceSchema = z.object({
|
|||
* The MIME type of this resource, if known.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* A template description for resources available on the server.
|
||||
*/
|
||||
export const ResourceTemplateSchema = z.object({
|
||||
export const ResourceTemplateSchema = z
|
||||
.object({
|
||||
/**
|
||||
* A URI template (according to RFC 6570) that can be used to construct resource URIs.
|
||||
*/
|
||||
|
|
@ -381,7 +400,8 @@ export const ResourceTemplateSchema = z.object({
|
|||
* The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* Sent from the client to request a list of resources the server has.
|
||||
*/
|
||||
|
|
@ -459,18 +479,21 @@ export const UnsubscribeRequestSchema = RequestSchema.extend({
|
|||
*/
|
||||
export const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
|
||||
method: z.literal("notifications/resources/updated"),
|
||||
params: z.object({
|
||||
params: z
|
||||
.object({
|
||||
/**
|
||||
* The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
|
||||
*/
|
||||
uri: z.string(),
|
||||
}),
|
||||
})
|
||||
.passthrough(),
|
||||
});
|
||||
/* Prompts */
|
||||
/**
|
||||
* Describes an argument that a prompt can accept.
|
||||
*/
|
||||
export const PromptArgumentSchema = z.object({
|
||||
export const PromptArgumentSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The name of the argument.
|
||||
*/
|
||||
|
|
@ -483,11 +506,13 @@ export const PromptArgumentSchema = z.object({
|
|||
* Whether this argument must be provided.
|
||||
*/
|
||||
required: z.optional(z.boolean()),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* A prompt or prompt template that the server offers.
|
||||
*/
|
||||
export const PromptSchema = z.object({
|
||||
export const PromptSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The name of the prompt or prompt template.
|
||||
*/
|
||||
|
|
@ -500,7 +525,8 @@ export const PromptSchema = z.object({
|
|||
* A list of arguments to use for templating the prompt.
|
||||
*/
|
||||
arguments: z.optional(z.array(PromptArgumentSchema)),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* Sent from the client to request a list of prompts and prompt templates the server has.
|
||||
*/
|
||||
|
|
@ -549,7 +575,8 @@ export const PromptListChangedNotificationSchema = NotificationSchema.extend({
|
|||
/**
|
||||
* Definition for a tool the client can call.
|
||||
*/
|
||||
export const ToolSchema = z.object({
|
||||
export const ToolSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The name of the tool.
|
||||
*/
|
||||
|
|
@ -561,11 +588,14 @@ export const ToolSchema = z.object({
|
|||
/**
|
||||
* A JSON Schema object defining the expected parameters for the tool.
|
||||
*/
|
||||
inputSchema: z.object({
|
||||
inputSchema: z
|
||||
.object({
|
||||
type: z.literal("object"),
|
||||
properties: z.optional(z.object({}).passthrough()),
|
||||
}),
|
||||
});
|
||||
})
|
||||
.passthrough(),
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* Sent from the client to request a list of tools the server has.
|
||||
*/
|
||||
|
|
@ -622,7 +652,8 @@ export const SetLevelRequestSchema = RequestSchema.extend({
|
|||
*/
|
||||
export const LoggingMessageNotificationSchema = NotificationSchema.extend({
|
||||
method: z.literal("notifications/message"),
|
||||
params: z.object({
|
||||
params: z
|
||||
.object({
|
||||
/**
|
||||
* The severity of this log message.
|
||||
*/
|
||||
|
|
@ -635,7 +666,8 @@ export const LoggingMessageNotificationSchema = NotificationSchema.extend({
|
|||
* The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
|
||||
*/
|
||||
data: z.unknown(),
|
||||
}),
|
||||
})
|
||||
.passthrough(),
|
||||
});
|
||||
/* Sampling */
|
||||
/**
|
||||
|
|
@ -687,23 +719,27 @@ export const CreateMessageResultSchema = ResultSchema.extend({
|
|||
/**
|
||||
* A reference to a resource or resource template definition.
|
||||
*/
|
||||
export const ResourceReferenceSchema = z.object({
|
||||
export const ResourceReferenceSchema = z
|
||||
.object({
|
||||
type: z.literal("ref/resource"),
|
||||
/**
|
||||
* The URI or URI template of the resource.
|
||||
*/
|
||||
uri: z.string(),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* Identifies a prompt.
|
||||
*/
|
||||
export const PromptReferenceSchema = z.object({
|
||||
export const PromptReferenceSchema = z
|
||||
.object({
|
||||
type: z.literal("ref/prompt"),
|
||||
/**
|
||||
* The name of the prompt or prompt template
|
||||
*/
|
||||
name: z.string(),
|
||||
});
|
||||
})
|
||||
.passthrough();
|
||||
/**
|
||||
* A request from the client to the server, to ask for completion options.
|
||||
*/
|
||||
|
|
@ -714,7 +750,8 @@ export const CompleteRequestSchema = RequestSchema.extend({
|
|||
/**
|
||||
* The argument's information
|
||||
*/
|
||||
argument: z.object({
|
||||
argument: z
|
||||
.object({
|
||||
/**
|
||||
* The name of the argument
|
||||
*/
|
||||
|
|
@ -723,14 +760,16 @@ export const CompleteRequestSchema = RequestSchema.extend({
|
|||
* The value of the argument to use for completion matching.
|
||||
*/
|
||||
value: z.string(),
|
||||
}),
|
||||
})
|
||||
.passthrough(),
|
||||
}),
|
||||
});
|
||||
/**
|
||||
* The server's response to a completion/complete request
|
||||
*/
|
||||
export const CompleteResultSchema = ResultSchema.extend({
|
||||
completion: z.object({
|
||||
completion: z
|
||||
.object({
|
||||
/**
|
||||
* An array of completion values. Must not exceed 100 items.
|
||||
*/
|
||||
|
|
@ -743,7 +782,8 @@ export const CompleteResultSchema = ResultSchema.extend({
|
|||
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
|
||||
*/
|
||||
hasMore: z.optional(z.boolean()),
|
||||
}),
|
||||
})
|
||||
.passthrough(),
|
||||
});
|
||||
/* Client messages */
|
||||
export const ClientRequestSchema = z.union([
|
||||
|
|
|
|||
2
dist/types.js.map
generated
vendored
2
dist/types.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,6 @@
|
|||
import { Protocol } from "../shared/protocol.js";
|
||||
import {
|
||||
ClientCapabilities,
|
||||
ClientRequest,
|
||||
Implementation,
|
||||
InitializedNotificationSchema,
|
||||
InitializeRequest,
|
||||
|
|
@ -83,20 +82,28 @@ export class Server extends Protocol<
|
|||
return this._clientVersion;
|
||||
}
|
||||
|
||||
private getCapability(
|
||||
reqType: ClientRequest["method"],
|
||||
): ServerCapabilities[keyof ServerCapabilities] {
|
||||
return this._requestHandlers.has(reqType as string) ? {} : undefined;
|
||||
}
|
||||
|
||||
private getCapabilities(): ServerCapabilities {
|
||||
return {
|
||||
prompts: this.getCapability(ListPromptsRequestSchema.shape.method.value),
|
||||
resources: this.getCapability(
|
||||
ListResourcesRequestSchema.shape.method.value,
|
||||
),
|
||||
tools: this.getCapability(ListToolsRequestSchema.shape.method.value),
|
||||
logging: this.getCapability(SetLevelRequestSchema.shape.method.value),
|
||||
prompts: this._requestHandlers.has(
|
||||
ListPromptsRequestSchema.shape.method.value as string,
|
||||
)
|
||||
? {}
|
||||
: undefined,
|
||||
resources: this._requestHandlers.has(
|
||||
ListResourcesRequestSchema.shape.method.value as string,
|
||||
)
|
||||
? {}
|
||||
: undefined,
|
||||
tools: this._requestHandlers.has(
|
||||
ListToolsRequestSchema.shape.method.value as string,
|
||||
)
|
||||
? {}
|
||||
: undefined,
|
||||
logging: this._requestHandlers.has(
|
||||
SetLevelRequestSchema.shape.method.value as string,
|
||||
)
|
||||
? {}
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
552
src/types.ts
552
src/types.ts
|
|
@ -151,58 +151,68 @@ export const EmptyResultSchema = ResultSchema.strict();
|
|||
/**
|
||||
* Text provided to or from an LLM.
|
||||
*/
|
||||
export const TextContentSchema = z.object({
|
||||
type: z.literal("text"),
|
||||
/**
|
||||
* The text content of the message.
|
||||
*/
|
||||
text: z.string(),
|
||||
});
|
||||
export const TextContentSchema = z
|
||||
.object({
|
||||
type: z.literal("text"),
|
||||
/**
|
||||
* The text content of the message.
|
||||
*/
|
||||
text: z.string(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* An image provided to or from an LLM.
|
||||
*/
|
||||
export const ImageContentSchema = z.object({
|
||||
type: z.literal("image"),
|
||||
/**
|
||||
* The base64-encoded image data.
|
||||
*/
|
||||
data: z.string().base64(),
|
||||
/**
|
||||
* The MIME type of the image. Different providers may support different image types.
|
||||
*/
|
||||
mimeType: z.string(),
|
||||
});
|
||||
export const ImageContentSchema = z
|
||||
.object({
|
||||
type: z.literal("image"),
|
||||
/**
|
||||
* The base64-encoded image data.
|
||||
*/
|
||||
data: z.string().base64(),
|
||||
/**
|
||||
* The MIME type of the image. Different providers may support different image types.
|
||||
*/
|
||||
mimeType: z.string(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* Describes a message issued to or received from an LLM API.
|
||||
*/
|
||||
export const SamplingMessageSchema = z.object({
|
||||
role: z.enum(["user", "assistant"]),
|
||||
content: z.union([TextContentSchema, ImageContentSchema]),
|
||||
});
|
||||
export const SamplingMessageSchema = z
|
||||
.object({
|
||||
role: z.enum(["user", "assistant"]),
|
||||
content: z.union([TextContentSchema, ImageContentSchema]),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* Describes the name and version of an MCP implementation.
|
||||
*/
|
||||
export const ImplementationSchema = z.object({
|
||||
name: z.string(),
|
||||
version: z.string(),
|
||||
});
|
||||
export const ImplementationSchema = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
version: z.string(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
|
||||
*/
|
||||
export const ClientCapabilitiesSchema = z.object({
|
||||
/**
|
||||
* Experimental, non-standard capabilities that the client supports.
|
||||
*/
|
||||
experimental: z.optional(z.object({}).passthrough()),
|
||||
/**
|
||||
* Present if the client supports sampling from an LLM.
|
||||
*/
|
||||
sampling: z.optional(z.object({}).passthrough()),
|
||||
});
|
||||
export const ClientCapabilitiesSchema = z
|
||||
.object({
|
||||
/**
|
||||
* Experimental, non-standard capabilities that the client supports.
|
||||
*/
|
||||
experimental: z.optional(z.object({}).passthrough()),
|
||||
/**
|
||||
* Present if the client supports sampling from an LLM.
|
||||
*/
|
||||
sampling: z.optional(z.object({}).passthrough()),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* This request is sent from the client to the server when it first connects, asking it to begin initialization.
|
||||
|
|
@ -222,59 +232,61 @@ export const InitializeRequestSchema = RequestSchema.extend({
|
|||
/**
|
||||
* Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
|
||||
*/
|
||||
export const ServerCapabilitiesSchema = z.object({
|
||||
/**
|
||||
* Experimental, non-standard capabilities that the server supports.
|
||||
*/
|
||||
experimental: z.optional(z.object({}).passthrough()),
|
||||
/**
|
||||
* Present if the server supports sending log messages to the client.
|
||||
*/
|
||||
logging: z.optional(z.object({}).passthrough()),
|
||||
/**
|
||||
* Present if the server offers any prompt templates.
|
||||
*/
|
||||
prompts: z.optional(
|
||||
z
|
||||
.object({
|
||||
/**
|
||||
* Whether this server supports notifications for changes to the prompt list.
|
||||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough(),
|
||||
),
|
||||
/**
|
||||
* Present if the server offers any resources to read.
|
||||
*/
|
||||
resources: z.optional(
|
||||
z
|
||||
.object({
|
||||
/**
|
||||
* Whether this server supports subscribing to resource updates.
|
||||
*/
|
||||
subscribe: z.optional(z.boolean()),
|
||||
/**
|
||||
* Whether this server supports notifications for changes to the resource list.
|
||||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough(),
|
||||
),
|
||||
/**
|
||||
* Present if the server offers any tools to call.
|
||||
*/
|
||||
tools: z.optional(
|
||||
z
|
||||
.object({
|
||||
/**
|
||||
* Whether this server supports notifications for changes to the tool list.
|
||||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough(),
|
||||
),
|
||||
});
|
||||
export const ServerCapabilitiesSchema = z
|
||||
.object({
|
||||
/**
|
||||
* Experimental, non-standard capabilities that the server supports.
|
||||
*/
|
||||
experimental: z.optional(z.object({}).passthrough()),
|
||||
/**
|
||||
* Present if the server supports sending log messages to the client.
|
||||
*/
|
||||
logging: z.optional(z.object({}).passthrough()),
|
||||
/**
|
||||
* Present if the server offers any prompt templates.
|
||||
*/
|
||||
prompts: z.optional(
|
||||
z
|
||||
.object({
|
||||
/**
|
||||
* Whether this server supports notifications for changes to the prompt list.
|
||||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough(),
|
||||
),
|
||||
/**
|
||||
* Present if the server offers any resources to read.
|
||||
*/
|
||||
resources: z.optional(
|
||||
z
|
||||
.object({
|
||||
/**
|
||||
* Whether this server supports subscribing to resource updates.
|
||||
*/
|
||||
subscribe: z.optional(z.boolean()),
|
||||
/**
|
||||
* Whether this server supports notifications for changes to the resource list.
|
||||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough(),
|
||||
),
|
||||
/**
|
||||
* Present if the server offers any tools to call.
|
||||
*/
|
||||
tools: z.optional(
|
||||
z
|
||||
.object({
|
||||
/**
|
||||
* Whether this server supports notifications for changes to the tool list.
|
||||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough(),
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* After receiving an initialize request from the client, the server sends this response.
|
||||
|
|
@ -304,16 +316,18 @@ export const PingRequestSchema = RequestSchema.extend({
|
|||
});
|
||||
|
||||
/* Progress notifications */
|
||||
export const ProgressSchema = z.object({
|
||||
/**
|
||||
* The progress thus far. This should increase every time progress is made, even if the total is unknown.
|
||||
*/
|
||||
progress: z.number(),
|
||||
/**
|
||||
* Total number of items to process (or total progress required), if known.
|
||||
*/
|
||||
total: z.optional(z.number()),
|
||||
});
|
||||
export const ProgressSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The progress thus far. This should increase every time progress is made, even if the total is unknown.
|
||||
*/
|
||||
progress: z.number(),
|
||||
/**
|
||||
* Total number of items to process (or total progress required), if known.
|
||||
*/
|
||||
total: z.optional(z.number()),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* An out-of-band notification used to inform the receiver of a progress update for a long-running request.
|
||||
|
|
@ -351,16 +365,18 @@ export const PaginatedResultSchema = ResultSchema.extend({
|
|||
/**
|
||||
* The contents of a specific resource or sub-resource.
|
||||
*/
|
||||
export const ResourceContentsSchema = z.object({
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
uri: z.string(),
|
||||
/**
|
||||
* The MIME type of this resource, if known.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
});
|
||||
export const ResourceContentsSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
uri: z.string(),
|
||||
/**
|
||||
* The MIME type of this resource, if known.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const TextResourceContentsSchema = ResourceContentsSchema.extend({
|
||||
/**
|
||||
|
|
@ -379,60 +395,64 @@ export const BlobResourceContentsSchema = ResourceContentsSchema.extend({
|
|||
/**
|
||||
* A known resource that the server is capable of reading.
|
||||
*/
|
||||
export const ResourceSchema = z.object({
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
uri: z.string(),
|
||||
export const ResourceSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
uri: z.string(),
|
||||
|
||||
/**
|
||||
* A human-readable name for this resource.
|
||||
*
|
||||
* This can be used by clients to populate UI elements.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* A human-readable name for this resource.
|
||||
*
|
||||
* This can be used by clients to populate UI elements.
|
||||
*/
|
||||
name: z.string(),
|
||||
|
||||
/**
|
||||
* A description of what this resource represents.
|
||||
*
|
||||
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* A description of what this resource represents.
|
||||
*
|
||||
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
|
||||
/**
|
||||
* The MIME type of this resource, if known.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
});
|
||||
/**
|
||||
* The MIME type of this resource, if known.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* A template description for resources available on the server.
|
||||
*/
|
||||
export const ResourceTemplateSchema = z.object({
|
||||
/**
|
||||
* A URI template (according to RFC 6570) that can be used to construct resource URIs.
|
||||
*/
|
||||
uriTemplate: z.string(),
|
||||
export const ResourceTemplateSchema = z
|
||||
.object({
|
||||
/**
|
||||
* A URI template (according to RFC 6570) that can be used to construct resource URIs.
|
||||
*/
|
||||
uriTemplate: z.string(),
|
||||
|
||||
/**
|
||||
* A human-readable name for the type of resource this template refers to.
|
||||
*
|
||||
* This can be used by clients to populate UI elements.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* A human-readable name for the type of resource this template refers to.
|
||||
*
|
||||
* This can be used by clients to populate UI elements.
|
||||
*/
|
||||
name: z.string(),
|
||||
|
||||
/**
|
||||
* A description of what this template is for.
|
||||
*
|
||||
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* A description of what this template is for.
|
||||
*
|
||||
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
|
||||
/**
|
||||
* The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
});
|
||||
/**
|
||||
* The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
|
||||
*/
|
||||
mimeType: z.optional(z.string()),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* Sent from the client to request a list of resources the server has.
|
||||
|
|
@ -524,50 +544,56 @@ export const UnsubscribeRequestSchema = RequestSchema.extend({
|
|||
*/
|
||||
export const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
|
||||
method: z.literal("notifications/resources/updated"),
|
||||
params: z.object({
|
||||
/**
|
||||
* The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
|
||||
*/
|
||||
uri: z.string(),
|
||||
}),
|
||||
params: z
|
||||
.object({
|
||||
/**
|
||||
* The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
|
||||
*/
|
||||
uri: z.string(),
|
||||
})
|
||||
.passthrough(),
|
||||
});
|
||||
|
||||
/* Prompts */
|
||||
/**
|
||||
* Describes an argument that a prompt can accept.
|
||||
*/
|
||||
export const PromptArgumentSchema = z.object({
|
||||
/**
|
||||
* The name of the argument.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* A human-readable description of the argument.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* Whether this argument must be provided.
|
||||
*/
|
||||
required: z.optional(z.boolean()),
|
||||
});
|
||||
export const PromptArgumentSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The name of the argument.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* A human-readable description of the argument.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* Whether this argument must be provided.
|
||||
*/
|
||||
required: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* A prompt or prompt template that the server offers.
|
||||
*/
|
||||
export const PromptSchema = z.object({
|
||||
/**
|
||||
* The name of the prompt or prompt template.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* An optional description of what this prompt provides
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* A list of arguments to use for templating the prompt.
|
||||
*/
|
||||
arguments: z.optional(z.array(PromptArgumentSchema)),
|
||||
});
|
||||
export const PromptSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The name of the prompt or prompt template.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* An optional description of what this prompt provides
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* A list of arguments to use for templating the prompt.
|
||||
*/
|
||||
arguments: z.optional(z.array(PromptArgumentSchema)),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* Sent from the client to request a list of prompts and prompt templates the server has.
|
||||
|
|
@ -622,23 +648,27 @@ export const PromptListChangedNotificationSchema = NotificationSchema.extend({
|
|||
/**
|
||||
* Definition for a tool the client can call.
|
||||
*/
|
||||
export const ToolSchema = z.object({
|
||||
/**
|
||||
* The name of the tool.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* A human-readable description of the tool.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* A JSON Schema object defining the expected parameters for the tool.
|
||||
*/
|
||||
inputSchema: z.object({
|
||||
type: z.literal("object"),
|
||||
properties: z.optional(z.object({}).passthrough()),
|
||||
}),
|
||||
});
|
||||
export const ToolSchema = z
|
||||
.object({
|
||||
/**
|
||||
* The name of the tool.
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* A human-readable description of the tool.
|
||||
*/
|
||||
description: z.optional(z.string()),
|
||||
/**
|
||||
* A JSON Schema object defining the expected parameters for the tool.
|
||||
*/
|
||||
inputSchema: z
|
||||
.object({
|
||||
type: z.literal("object"),
|
||||
properties: z.optional(z.object({}).passthrough()),
|
||||
})
|
||||
.passthrough(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* Sent from the client to request a list of tools the server has.
|
||||
|
|
@ -703,20 +733,22 @@ export const SetLevelRequestSchema = RequestSchema.extend({
|
|||
*/
|
||||
export const LoggingMessageNotificationSchema = NotificationSchema.extend({
|
||||
method: z.literal("notifications/message"),
|
||||
params: z.object({
|
||||
/**
|
||||
* The severity of this log message.
|
||||
*/
|
||||
level: LoggingLevelSchema,
|
||||
/**
|
||||
* An optional name of the logger issuing this message.
|
||||
*/
|
||||
logger: z.optional(z.string()),
|
||||
/**
|
||||
* The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
|
||||
*/
|
||||
data: z.unknown(),
|
||||
}),
|
||||
params: z
|
||||
.object({
|
||||
/**
|
||||
* The severity of this log message.
|
||||
*/
|
||||
level: LoggingLevelSchema,
|
||||
/**
|
||||
* An optional name of the logger issuing this message.
|
||||
*/
|
||||
logger: z.optional(z.string()),
|
||||
/**
|
||||
* The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
|
||||
*/
|
||||
data: z.unknown(),
|
||||
})
|
||||
.passthrough(),
|
||||
});
|
||||
|
||||
/* Sampling */
|
||||
|
|
@ -771,24 +803,28 @@ export const CreateMessageResultSchema = ResultSchema.extend({
|
|||
/**
|
||||
* A reference to a resource or resource template definition.
|
||||
*/
|
||||
export const ResourceReferenceSchema = z.object({
|
||||
type: z.literal("ref/resource"),
|
||||
/**
|
||||
* The URI or URI template of the resource.
|
||||
*/
|
||||
uri: z.string(),
|
||||
});
|
||||
export const ResourceReferenceSchema = z
|
||||
.object({
|
||||
type: z.literal("ref/resource"),
|
||||
/**
|
||||
* The URI or URI template of the resource.
|
||||
*/
|
||||
uri: z.string(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* Identifies a prompt.
|
||||
*/
|
||||
export const PromptReferenceSchema = z.object({
|
||||
type: z.literal("ref/prompt"),
|
||||
/**
|
||||
* The name of the prompt or prompt template
|
||||
*/
|
||||
name: z.string(),
|
||||
});
|
||||
export const PromptReferenceSchema = z
|
||||
.object({
|
||||
type: z.literal("ref/prompt"),
|
||||
/**
|
||||
* The name of the prompt or prompt template
|
||||
*/
|
||||
name: z.string(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/**
|
||||
* A request from the client to the server, to ask for completion options.
|
||||
|
|
@ -800,16 +836,18 @@ export const CompleteRequestSchema = RequestSchema.extend({
|
|||
/**
|
||||
* The argument's information
|
||||
*/
|
||||
argument: z.object({
|
||||
/**
|
||||
* The name of the argument
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* The value of the argument to use for completion matching.
|
||||
*/
|
||||
value: z.string(),
|
||||
}),
|
||||
argument: z
|
||||
.object({
|
||||
/**
|
||||
* The name of the argument
|
||||
*/
|
||||
name: z.string(),
|
||||
/**
|
||||
* The value of the argument to use for completion matching.
|
||||
*/
|
||||
value: z.string(),
|
||||
})
|
||||
.passthrough(),
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -817,20 +855,22 @@ export const CompleteRequestSchema = RequestSchema.extend({
|
|||
* The server's response to a completion/complete request
|
||||
*/
|
||||
export const CompleteResultSchema = ResultSchema.extend({
|
||||
completion: z.object({
|
||||
/**
|
||||
* An array of completion values. Must not exceed 100 items.
|
||||
*/
|
||||
values: z.array(z.string()).max(100),
|
||||
/**
|
||||
* The total number of completion options available. This can exceed the number of values actually sent in the response.
|
||||
*/
|
||||
total: z.optional(z.number().int()),
|
||||
/**
|
||||
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
|
||||
*/
|
||||
hasMore: z.optional(z.boolean()),
|
||||
}),
|
||||
completion: z
|
||||
.object({
|
||||
/**
|
||||
* An array of completion values. Must not exceed 100 items.
|
||||
*/
|
||||
values: z.array(z.string()).max(100),
|
||||
/**
|
||||
* The total number of completion options available. This can exceed the number of values actually sent in the response.
|
||||
*/
|
||||
total: z.optional(z.number().int()),
|
||||
/**
|
||||
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
|
||||
*/
|
||||
hasMore: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough(),
|
||||
});
|
||||
|
||||
/* Client messages */
|
||||
|
|
|
|||
Loading…
Reference in a new issue