/** * ┌─────────────────────────────────────────────────────────────────────────┐ * │ ANSWER PDF QUESTION TOOL - MCP Tool Implementation │ * ├─────────────────────────────────────────────────────────────────────────┤ * │ Filename: answer-question.tool.ts │ * │ Language: TypeScript │ * │ MCP Server: PDF Operations Server │ * │ │ * │ Purpose: │ * │ Implements an MCP tool that answers questions about PDF content │ * │ using LLM sampling. Extracts relevant context from PDF and uses │ * │ the LLM to generate accurate answers based on the document. │ * │ │ * │ Why this tool exists: │ * │ - Enables interactive Q&A with PDF documents │ * │ - Provides context-aware answers from document content │ * │ - Useful for research and information extraction │ * │ - Supports natural language queries about documents │ * │ │ * │ MCP Tool Information: │ * │ Tool Name: answer-pdf-question │ * │ Category: pdf-operations │ * │ Input: { filePath: string, question: string, maxTokens?: number } │ * │ Output: { answer: string, question, context, filePath } │ * │ │ * │ Dependencies: │ * │ - @modelcontextprotocol/sdk: MCP server SDK (for LLM sampling) │ * │ - zod: Input validation and schema definition │ * │ - ../utils/pdf-utils: PDF text extraction │ * │ │ * │ Note: │ * │ This tool uses MCP sampling to call the LLM. The client must │ * │ support the sampling feature for this to work. │ * │ │ * │ Author: PDF MCP Team │ * │ Created: 2025-10-29 │ * │ Version: 1.0.0 │ * └─────────────────────────────────────────────────────────────────────────┘ */ import { z } from 'zod'; import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { QuestionAnswerResult } from '../types.js'; /** * Zod schema for answer-pdf-question tool input validation */ export declare const AnswerQuestionInputSchema: { filePath: z.ZodString; question: z.ZodString; maxTokens: z.ZodOptional; }; /** * Zod schema for answer-pdf-question tool output */ export declare const AnswerQuestionOutputSchema: { answer: z.ZodString; question: z.ZodString; context: z.ZodString; filePath: z.ZodString; }; /** * Answers a question about PDF content using LLM sampling * * @param filePath - Path to the PDF file * @param question - Question to answer * @param mcpServer - MCP server instance for LLM sampling * @param maxTokens - Maximum tokens for answer (default: 500) * @returns Object containing answer, question, context, and metadata * @throws Error if file cannot be read or LLM sampling fails */ export declare function answerPDFQuestion(filePath: string, question: string, mcpServer: McpServer, maxTokens?: number): Promise; /** * Creates tool handler for answer-pdf-question * * @param mcpServer - MCP server instance for LLM sampling * @returns Tool handler function */ export declare const createAnswerQuestionToolHandler: (mcpServer: McpServer) => ({ filePath, question, maxTokens }: { filePath: string; question: string; maxTokens?: number | undefined; }) => Promise<{ content: { type: "text"; text: string; }[]; structuredContent: QuestionAnswerResult; }>; //# sourceMappingURL=answer-question.tool.d.ts.map