From 2b60822057f6f288ac0752df6dd9e56cd8b44e34 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Sat, 13 Dec 2025 14:20:24 -0500 Subject: [PATCH] Refactor-renamed long-running-operation.ts to trigger-long-running-operation.ts --- src/everything/docs/features.md | 2 +- src/everything/docs/structure.md | 4 ++-- src/everything/tools/index.ts | 4 ++-- ...tion.ts => trigger-long-running-operation.ts} | 16 ++++++++-------- 4 files changed, 13 insertions(+), 13 deletions(-) rename src/everything/tools/{long-running-operation.ts => trigger-long-running-operation.ts} (83%) diff --git a/src/everything/docs/features.md b/src/everything/docs/features.md index 92370136..6813abe5 100644 --- a/src/everything/docs/features.md +++ b/src/everything/docs/features.md @@ -18,7 +18,7 @@ - `get-structured-content` (tools/get-structured-content.ts): Demonstrates structured responses. Accepts `location` input and returns both backward‑compatible `content` (a `text` block containing JSON) and `structuredContent` validated by an `outputSchema` (temperature, conditions, humidity). - `get-sum` (tools/get-sum.ts): For two numbers `a` and `b` calculates and returns their sum. Uses Zod to validate inputs. - `get-tiny-image` (tools/get-tiny-image.ts): Returns a tiny PNG MCP logo as an `image` content item with brief descriptive text before and after. -- `long-running-operation` (tools/long-running-operation.ts): Simulates a multi-step operation over a given `duration` and number of `steps`; reports progress via `notifications/progress` when a `progressToken` is provided by the client. +- `trigger-long-running-operation` (tools/trigger-trigger-long-running-operation.ts): Simulates a multi-step operation over a given `duration` and number of `steps`; reports progress via `notifications/progress` when a `progressToken` is provided by the client. - `toggle-simulated-logging` (tools/toggle-simulated-logging.ts): Starts or stops simulated, random‑leveled logging for the invoking session. Respects the client’s selected minimum logging level. - `toggle-subscriber-updates` (tools/toggle-subscriber-updates.ts): Starts or stops simulated resource update notifications for URIs the invoking session has subscribed to. - `trigger-sampling-request` (tools/trigger-sampling-request.ts): Issues a `sampling/createMessage` request to the client/LLM using provided `prompt` and optional generation controls; returns the LLM’s response payload. diff --git a/src/everything/docs/structure.md b/src/everything/docs/structure.md index c8703f1a..0bb5c5f3 100644 --- a/src/everything/docs/structure.md +++ b/src/everything/docs/structure.md @@ -47,10 +47,10 @@ src/everything │ ├── get-sum.ts │ ├── get-tiny-image.ts │ ├── gzip-file-as-resource.ts - │ ├── long-running-operation.ts │ ├── toggle-simulated-logging.ts │ ├── toggle-subscriber-updates.ts │ ├── trigger-elicitation-request.ts + │ ├── trigger-long-running-operation.ts │ └── trigger-sampling-request.ts └── transports ├── sse.ts @@ -156,7 +156,7 @@ src/everything - Registers an `get-sum` tool with a Zod input schema that sums two numbers `a` and `b` and returns the result. - `get-tiny-image.ts` - Registers a `get-tiny-image` tool, which returns a tiny PNG MCP logo as an `image` content item, along with surrounding descriptive `text` items. -- `long-running-operation.ts` +- `trigger-long-running-operation.ts` - Registers a `long-running-operation` tool that simulates a long-running task over a specified `duration` (seconds) and number of `steps`; emits `notifications/progress` updates when the client supplies a `progressToken`. - `toggle-simulated-logging.ts` - Registers a `toggle-simulated-logging` tool, which starts or stops simulated logging for the invoking session. diff --git a/src/everything/tools/index.ts b/src/everything/tools/index.ts index 55a9878c..980afb4b 100644 --- a/src/everything/tools/index.ts +++ b/src/everything/tools/index.ts @@ -9,10 +9,10 @@ import { registerGetStructuredContentTool } from "./get-structured-content.js"; import { registerGetSumTool } from "./get-sum.js"; import { registerGetTinyImageTool } from "./get-tiny-image.js"; import { registerGZipFileAsResourceTool } from "./gzip-file-as-resource.js"; -import { registerLongRunningOperationTool } from "./long-running-operation.js"; import { registerToggleSimulatedLoggingTool } from "./toggle-simulated-logging.js"; import { registerToggleSubscriberUpdatesTool } from "./toggle-subscriber-updates.js"; import { registerTriggerElicitationRequestTool } from "./trigger-elicitation-request.js"; +import { registerTriggerLongRunningOperationTool } from "./trigger-long-running-operation.js"; import { registerTriggerSamplingRequestTool } from "./trigger-sampling-request.js"; /** @@ -30,9 +30,9 @@ export const registerTools = (server: McpServer) => { registerGetSumTool(server); registerGetTinyImageTool(server); registerGZipFileAsResourceTool(server); - registerLongRunningOperationTool(server); registerToggleSimulatedLoggingTool(server); registerToggleSubscriberUpdatesTool(server); registerTriggerElicitationRequestTool(server); + registerTriggerLongRunningOperationTool(server); registerTriggerSamplingRequestTool(server); }; diff --git a/src/everything/tools/long-running-operation.ts b/src/everything/tools/trigger-long-running-operation.ts similarity index 83% rename from src/everything/tools/long-running-operation.ts rename to src/everything/tools/trigger-long-running-operation.ts index 1b4037ad..47d09790 100644 --- a/src/everything/tools/long-running-operation.ts +++ b/src/everything/tools/trigger-long-running-operation.ts @@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; // Tool input schema -const LongRunningOperationSchema = z.object({ +const TriggerLongRunningOperationSchema = z.object({ duration: z .number() .default(10) @@ -12,15 +12,15 @@ const LongRunningOperationSchema = z.object({ }); // Tool configuration -const name = "long-running-operation"; +const name = "trigger-long-running-operation"; const config = { - title: "Long Running Operation Tool", - description: "Demonstrates a long running operation with progress updates", - inputSchema: LongRunningOperationSchema, + title: "Trigger Long Running Operation Tool", + description: "Demonstrates a long running operation with progress updates.", + inputSchema: TriggerLongRunningOperationSchema, }; /** - * Registers the 'long-running-operation' tool with the provided McpServer instance. + * Registers the 'trigger-tong-running-operation' tool with the provided McpServer instance. * * This function defines and registers a tool with the provided server instance that performs a * long-running operation defined by a specific duration and number of steps. The progress @@ -35,12 +35,12 @@ const config = { * @param {McpServer} server - The server instance where the tool should be registered. * The server is responsible for receiving and handling requests, as well as sending progress notifications. */ -export const registerLongRunningOperationTool = (server: McpServer) => { +export const registerTriggerLongRunningOperationTool = (server: McpServer) => { server.registerTool( name, config, async (args, extra): Promise => { - const validatedArgs = LongRunningOperationSchema.parse(args); + const validatedArgs = TriggerLongRunningOperationSchema.parse(args); const { duration, steps } = validatedArgs; const stepDuration = duration / steps; const progressToken = extra._meta?.progressToken;