Use explicit capabilities lists for now

This commit is contained in:
Justin Spahr-Summers 2024-11-11 22:38:43 +00:00
commit 7ab5880569
No known key found for this signature in database

View file

@ -73,7 +73,10 @@ export class Server<
/**
* Initializes this server with the given name and version information.
*/
constructor(private _serverInfo: Implementation) {
constructor(
private _serverInfo: Implementation,
private _capabilities: ServerCapabilities,
) {
super();
this.setRequestHandler(InitializeRequestSchema, (request) =>
@ -116,28 +119,7 @@ export class Server<
}
private getCapabilities(): ServerCapabilities {
return {
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,
};
return this._capabilities;
}
private assertCapability(