[WIP] Refactor everything server to be more modular and use recommended APIs.

Added print-env, and sampling-request tools

* Updated architecture.md

* In tools/index.ts
  - import registerPrintEnvTool and registerSamplingRequestTool
  - in registerTools
    - call registerPrintEnvTool and registerSamplingRequestTool

* Added tools/print-env.ts
  - registers a tool that takes no args and returns the environment variables

* Added tools/sampling-request
  - registers a tool that
    - takes prompt and maxTokens args
    - sends client a sampling request
    - returns the client response in the result
This commit is contained in:
cliffhall
2025-12-08 19:14:06 -05:00
parent 1df8623bcc
commit 0f3e27ef87
4 changed files with 139 additions and 7 deletions

View File

@@ -1,18 +1,22 @@
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { registerEchoTool } from "./echo.js";
import { registerAddTool } from "./add.js";
import { registerEchoTool } from "./echo.js";
import { registerLongRunningOperationTool } from "./long-running-operation.js";
import { registerPrintEnvTool } from "./print-env.js";
import { registerSamplingRequestTool } from "./sampling-request.js";
import { registerToggleLoggingTool } from "./toggle-logging.js";
import { registerToggleSubscriberUpdatesTool } from "./toggle-subscriber-updates.js";
import { registerLongRunningOperationTool } from "./long-running-operation.js";
/**
* Register the tools with the MCP server.
* @param server
*/
export const registerTools = (server: McpServer) => {
registerEchoTool(server);
registerAddTool(server);
registerEchoTool(server);
registerLongRunningOperationTool(server);
registerPrintEnvTool(server);
registerSamplingRequestTool(server);
registerToggleLoggingTool(server);
registerToggleSubscriberUpdatesTool(server);
registerLongRunningOperationTool(server);
};