UNPKG

pocketsmith-mcp

Version:

MCP server for managing budgets via PocketSmith API

77 lines (76 loc) 3.09 kB
/** * @fileoverview Defines the core logic, schemas, and types for the `echo_message` tool. * This module includes input validation using Zod, type definitions for input and output, * and the main processing function that handles message formatting and repetition. * @module src/mcp-server/tools/echoTool/logic */ import { z } from "zod"; import { type RequestContext } from "../../../utils/index.js"; /** * Defines the valid formatting modes for the echo tool operation. */ export declare const ECHO_MODES: readonly ["standard", "uppercase", "lowercase"]; /** * Zod schema defining the input parameters for the `echo_message` tool. * This schema is used by the MCP SDK to validate the arguments provided when the tool is called. */ export declare const EchoToolInputSchema: z.ZodObject<{ message: z.ZodString; mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["standard", "uppercase", "lowercase"]>>>; repeat: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; timestamp: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; }, "strip", z.ZodTypeAny, { repeat: number; message: string; timestamp: boolean; mode: "standard" | "uppercase" | "lowercase"; }, { message: string; repeat?: number | undefined; timestamp?: boolean | undefined; mode?: "standard" | "uppercase" | "lowercase" | undefined; }>; /** * TypeScript type inferred from `EchoToolInputSchema`. * Represents the validated input parameters for the echo tool. */ export type EchoToolInput = z.infer<typeof EchoToolInputSchema>; /** * Zod schema for the successful response of the `echo_message` tool. */ export declare const EchoToolResponseSchema: z.ZodObject<{ originalMessage: z.ZodString; formattedMessage: z.ZodString; repeatedMessage: z.ZodString; mode: z.ZodEnum<["standard", "uppercase", "lowercase"]>; repeatCount: z.ZodNumber; timestamp: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { originalMessage: string; mode: "standard" | "uppercase" | "lowercase"; formattedMessage: string; repeatedMessage: string; repeatCount: number; timestamp?: string | undefined; }, { originalMessage: string; mode: "standard" | "uppercase" | "lowercase"; formattedMessage: string; repeatedMessage: string; repeatCount: number; timestamp?: string | undefined; }>; /** * Defines the structure of the JSON payload returned by the `echo_message` tool. */ export type EchoToolResponse = z.infer<typeof EchoToolResponseSchema>; /** * Processes the core logic for the `echo_message` tool. * It takes validated input parameters, formats the message according to the specified mode, * repeats it as requested, and optionally adds a timestamp to the response. * * @param params - The validated input parameters for the echo tool. * @param context - The request context, used for logging and tracing the operation. * @returns A promise that resolves with an object containing the processed response data. */ export declare function echoToolLogic(params: EchoToolInput, context: RequestContext): Promise<EchoToolResponse>;