pocketsmith-mcp
Version:
MCP server for managing budgets via PocketSmith API
54 lines (53 loc) • 2.03 kB
TypeScript
/**
* @fileoverview Defines the core logic, schemas, and types for the `get_random_cat_fact` tool.
* This tool fetches a random cat fact from the public Cat Fact Ninja API.
* @module src/mcp-server/tools/catFactFetcher/logic
*/
import { z } from "zod";
import { type RequestContext } from "../../../utils/index.js";
/**
* Zod schema for validating input arguments for the `get_random_cat_fact` tool.
*/
export declare const CatFactFetcherInputSchema: z.ZodObject<{
maxLength: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
maxLength?: number | undefined;
}, {
maxLength?: number | undefined;
}>;
/**
* TypeScript type inferred from `CatFactFetcherInputSchema`.
*/
export type CatFactFetcherInput = z.infer<typeof CatFactFetcherInputSchema>;
/**
* Zod schema for the successful response of the `get_random_cat_fact` tool.
*/
export declare const CatFactFetcherResponseSchema: z.ZodObject<{
fact: z.ZodString;
length: z.ZodNumber;
requestedMaxLength: z.ZodOptional<z.ZodNumber>;
timestamp: z.ZodString;
}, "strip", z.ZodTypeAny, {
length: number;
timestamp: string;
fact: string;
requestedMaxLength?: number | undefined;
}, {
length: number;
timestamp: string;
fact: string;
requestedMaxLength?: number | undefined;
}>;
/**
* Defines the structure of the JSON payload returned by the `get_random_cat_fact` tool handler.
*/
export type CatFactFetcherResponse = z.infer<typeof CatFactFetcherResponseSchema>;
/**
* Processes the core logic for the `get_random_cat_fact` tool.
* It calls the Cat Fact Ninja API and returns the fetched fact.
* @param params - The validated input parameters for the tool.
* @param context - The request context for logging and tracing.
* @returns A promise that resolves to an object containing the cat fact data.
* @throws {McpError} If the API request fails or returns an error.
*/
export declare function catFactFetcherLogic(params: CatFactFetcherInput, context: RequestContext): Promise<CatFactFetcherResponse>;