diff --git a/src/server/index.test.ts b/src/server/index.test.ts index 0a23955af..34c2503d6 100644 --- a/src/server/index.test.ts +++ b/src/server/index.test.ts @@ -38,6 +38,7 @@ test("should accept latest protocol version", async () => { name: "test server", version: "1.0", }, + instructions: "Test instructions", }); sendPromiseResolve(undefined); } @@ -57,6 +58,7 @@ test("should accept latest protocol version", async () => { tools: {}, logging: {}, }, + instructions: "Test instructions", }, ); diff --git a/src/server/index.ts b/src/server/index.ts index d15ad3c0d..0333ad87d 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -33,6 +33,11 @@ export type ServerOptions = ProtocolOptions & { * Capabilities to advertise as being supported by this server. */ capabilities: ServerCapabilities; + + /** + * Optional instructions describing how to use the server and its features. + */ + instructions?: string; }; /** @@ -72,6 +77,7 @@ export class Server< private _clientCapabilities?: ClientCapabilities; private _clientVersion?: Implementation; private _capabilities: ServerCapabilities; + private _instructions?: string; /** * Callback for when initialization has fully completed (i.e., the client has sent an `initialized` notification). @@ -87,6 +93,7 @@ export class Server< ) { super(options); this._capabilities = options.capabilities; + this._instructions = options.instructions; this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request), @@ -234,6 +241,7 @@ export class Server< : LATEST_PROTOCOL_VERSION, capabilities: this.getCapabilities(), serverInfo: this._serverInfo, + ...(this._instructions && { instructions: this._instructions }), }; }