mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-17 23:53:24 +02:00
[WIP] Refactor everything server to be more modular and use recommended APIs.
Adding Trigger Elicitation Request and Get Roots List tools
* Updated architecture.md
* Added roots.ts
- tracks roots by sessionId
- setRootsListChangedHandler
- listens for roots changed notification from the client
- updates the roots map by sessionId
- sends log notification or error to the client
* In server/index.ts
- import setRootsListChangedHandler
- in clientConnected callback
- call setRootsListChangedHandler passing server and sessionId
* In sse.ts, stdio.ts, and streamableHttp.ts
- receive clientConnected from server factory
- call clientConnected when server is connected to transport
* Added get-roots-list.ts
- registerGetRootsListTool
- Registers the 'get-roots-list' tool with the given MCP server.
* Added trigger-elicitation-request.ts
- registerTriggerElicitationRequestTool
- registered tool sends an elicitation request that exercises all supported field types
* In tools/index.ts
- imports registerTriggerElicitationRequestTool and registerGetRootsListTool
- in registerTools
- call registerTriggerElicitationRequestTool and registerGetRootsListTool, passing server
This commit is contained in:
@@ -4,6 +4,7 @@ import { registerEchoTool } from "./echo.js";
|
||||
import { registerGetEnvTool } from "./get-env.js";
|
||||
import { registerGetResourceLinksTool } from "./get-resource-links.js";
|
||||
import { registerGetResourceReferenceTool } from "./get-resource-reference.js";
|
||||
import { registerGetRootsListTool } from "./get-roots-list.js";
|
||||
import { registerGetStructuredContentTool } from "./get-structured-content.js";
|
||||
import { registerGetSumTool } from "./get-sum.js";
|
||||
import { registerGetTinyImageTool } from "./get-tiny-image.js";
|
||||
@@ -11,8 +12,8 @@ import { registerGZipFileAsResourceTool } from "./gzip-file-as-resource.js";
|
||||
import { registerLongRunningOperationTool } from "./long-running-operation.js";
|
||||
import { registerToggleLoggingTool } from "./toggle-logging.js";
|
||||
import { registerToggleSubscriberUpdatesTool } from "./toggle-subscriber-updates.js";
|
||||
import { registerTriggerSamplingRequestTool } from "./trigger-sampling-request.js";
|
||||
import { registerTriggerElicitationRequestTool } from "./trigger-elicitation-request.js";
|
||||
import { registerTriggerSamplingRequestTool } from "./trigger-sampling-request.js";
|
||||
|
||||
/**
|
||||
* Register the tools with the MCP server.
|
||||
@@ -24,6 +25,7 @@ export const registerTools = (server: McpServer) => {
|
||||
registerGetEnvTool(server);
|
||||
registerGetResourceLinksTool(server);
|
||||
registerGetResourceReferenceTool(server);
|
||||
registerGetRootsListTool(server);
|
||||
registerGetStructuredContentTool(server);
|
||||
registerGetSumTool(server);
|
||||
registerGetTinyImageTool(server);
|
||||
|
||||
Reference in New Issue
Block a user