Skip to content

Commit 6b649da

Browse files
chore: MCP-248 add search index info in debug resource
1 parent 2a52e2c commit 6b649da

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/resources/common/debug.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ export class DebugResource extends ReactiveResource<
5656
}
5757
}
5858

59-
toOutput(): string {
59+
async toOutput(): Promise<string> {
6060
let result = "";
6161

6262
switch (this.current.tag) {
63-
case "connected":
64-
result += "The user is connected to the MongoDB cluster.";
63+
case "connected": {
64+
const searchIndexesSupported = await this.session.isSearchIndexSupported();
65+
result += `The user is connected to the MongoDB cluster${searchIndexesSupported ? " with support for search indexes." : ""}.`;
6566
break;
67+
}
6668
case "errored":
6769
result += `The user is not connected to a MongoDB cluster because of an error.\n`;
6870
if (this.current.connectedAtlasCluster) {

src/resources/resource.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ export abstract class ReactiveResource<Value, RelevantEvents extends readonly (k
7373
this.server.mcpServer.registerResource(this.name, this.uri, this.resourceConfig, this.resourceCallback);
7474
}
7575

76-
private resourceCallback: ReadResourceCallback = (uri) => ({
76+
private resourceCallback: ReadResourceCallback = async (uri) => ({
7777
contents: [
7878
{
79-
text: this.toOutput(),
79+
text: await this.toOutput(),
8080
mimeType: "application/json",
8181
uri: uri.href,
8282
},
@@ -101,5 +101,5 @@ export abstract class ReactiveResource<Value, RelevantEvents extends readonly (k
101101
}
102102

103103
protected abstract reduce(eventName: RelevantEvents[number], ...event: PayloadOf<RelevantEvents[number]>[]): Value;
104-
public abstract toOutput(): string;
104+
public abstract toOutput(): string | Promise<string>;
105105
}

0 commit comments

Comments
 (0)