Skip to content

Commit c5d34a5

Browse files
authored
Merge pull request #48 from QuantGeekDev/fix/enable-tools-capability
fix: detect tools capability using toolLoader
2 parents 5a7672c + 1e4c71f commit c5d34a5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/core/MCPServer.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ export class MCPServer {
313313
}
314314

315315
if (this.capabilities.resources) {
316-
// No request parameter for ListResources
317316
this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
318317
return {
319318
resources: Array.from(this.resourcesMap.values()).map(
@@ -380,13 +379,18 @@ export class MCPServer {
380379
}
381380

382381
private async detectCapabilities(): Promise<ServerCapabilities> {
382+
if (await this.toolLoader.hasTools()) {
383+
this.capabilities.tools = {};
384+
logger.debug("Tools capability enabled");
385+
}
386+
383387
if (await this.promptLoader.hasPrompts()) {
384-
this.capabilities.prompts = {}; // Indicate capability exists, but don't claim listChanged
388+
this.capabilities.prompts = {};
385389
logger.debug("Prompts capability enabled");
386390
}
387391

388392
if (await this.resourceLoader.hasResources()) {
389-
this.capabilities.resources = {}; // Indicate capability exists, but don't claim listChanged/subscribe
393+
this.capabilities.resources = {};
390394
logger.debug("Resources capability enabled");
391395
}
392396

0 commit comments

Comments
 (0)