/** * ┌─────────────────────────────────────────────────────────────────────────┐ * │ ADD WATERMARK TOOL - MCP Tool Implementation │ * ├─────────────────────────────────────────────────────────────────────────┤ * │ Filename: add-watermark.tool.ts │ * │ Language: TypeScript │ * │ MCP Server: PDF Operations Server │ * │ │ * │ Purpose: │ * │ Implements an MCP tool that adds custom watermarks to PDF files. │ * │ Supports full customization including position, color, opacity, │ * │ rotation, and more. Optimized for large PDFs (300+ pages). │ * │ │ * │ Why this tool exists: │ * │ - Enables AI to add watermarks to PDFs programmatically │ * │ - Supports branding and document protection workflows │ * │ - Provides flexible positioning and styling options │ * │ - Handles large PDFs efficiently with batch processing │ * │ │ * │ MCP Tool Information: │ * │ Tool Name: add-pdf-watermark │ * │ Category: pdf-operations │ * │ Input: { filePath, text, position, x, y, fontSize, color, opacity, │ * │ rotation, margin, outputPath, useBatchProcessing } │ * │ Output: { outputPath, pagesProcessed, originalPath, config } │ * │ │ * │ Features: │ * │ - Position presets: top-left, top-right, bottom-left, bottom-right, │ * │ top-center, bottom-center, center, custom │ * │ - Custom colors using RGB values (0-1 range) │ * │ - Opacity control (0-1, fully transparent to fully opaque) │ * │ - Rotation in degrees │ * │ - Margin control for preset positions │ * │ - Batch processing for large PDFs (optional) │ * │ │ * │ Dependencies: │ * │ - @modelcontextprotocol/sdk: MCP server SDK │ * │ - zod: Input validation and schema definition │ * │ - ../utils/watermark-utils: Watermark processing functions │ * │ │ * │ Author: PDF MCP Team │ * │ Created: 2025-10-29 │ * │ Version: 1.0.0 │ * └─────────────────────────────────────────────────────────────────────────┘ */ import { z } from 'zod'; import type { WatermarkResult } from '../types.js'; /** * Zod schema for add-pdf-watermark tool input validation */ export declare const AddWatermarkInputSchema: { filePath: z.ZodString; text: z.ZodString; position: z.ZodOptional>; x: z.ZodOptional; y: z.ZodOptional; fontSize: z.ZodOptional; color: z.ZodOptional>; opacity: z.ZodOptional; rotation: z.ZodOptional; margin: z.ZodOptional; outputPath: z.ZodOptional; useBatchProcessing: z.ZodOptional; font: z.ZodOptional; style: z.ZodOptional; }; /** * Zod schema for add-pdf-watermark tool output */ export declare const AddWatermarkOutputSchema: { outputPath: z.ZodString; pagesProcessed: z.ZodNumber; originalPath: z.ZodString; config: z.ZodObject<{ text: z.ZodString; position: z.ZodString; fontSize: z.ZodOptional; font: z.ZodOptional; style: z.ZodOptional; color: z.ZodOptional>; opacity: z.ZodOptional; rotation: z.ZodOptional; margin: z.ZodOptional; }, "strip", z.ZodTypeAny, { text: string; position: string; fontSize?: number | undefined; color?: { r: number; g: number; b: number; } | undefined; opacity?: number | undefined; rotation?: number | undefined; margin?: number | undefined; font?: string | undefined; style?: string | undefined; }, { text: string; position: string; fontSize?: number | undefined; color?: { r: number; g: number; b: number; } | undefined; opacity?: number | undefined; rotation?: number | undefined; margin?: number | undefined; font?: string | undefined; style?: string | undefined; }>; }; /** * Adds watermark to a PDF file * * @param params - Watermark configuration parameters * @returns Object containing output path, pages processed, and configuration * @throws Error if file cannot be processed */ export declare function addWatermark(params: { filePath: string; text: string; position?: 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center' | 'center' | 'custom' | undefined; x?: number | undefined; y?: number | undefined; fontSize?: number | undefined; font?: string | undefined; style?: string | undefined; color?: { r: number; g: number; b: number; } | undefined; opacity?: number | undefined; rotation?: number | undefined; margin?: number | undefined; outputPath?: string | undefined; useBatchProcessing?: boolean | undefined; }): Promise; /** * Tool handler for add-pdf-watermark * Formats the result for MCP protocol with base64-encoded file for download */ export declare const addWatermarkToolHandler: (params: { filePath: string; text: string; position?: "top-left" | "top-right" | "top-center" | "bottom-left" | "bottom-right" | "bottom-center" | "center" | "custom" | undefined; x?: number | undefined; y?: number | undefined; fontSize?: number | undefined; color?: { r: number; g: number; b: number; } | undefined; opacity?: number | undefined; rotation?: number | undefined; margin?: number | undefined; outputPath?: string | undefined; useBatchProcessing?: boolean | undefined; }) => Promise<{ content: ({ type: "text"; text: string; resource?: never; } | { type: "resource"; resource: { uri: string; mimeType: string; text: string; }; text?: never; })[]; structuredContent: WatermarkResult; }>; //# sourceMappingURL=add-watermark.tool.d.ts.map