/** * log10x_product_qa — answer product questions from the shipped docs corpus. * * Why this tool exists * * Agents constantly hit factual questions about Log10x — "what is the * Receiver", "how does pattern_hash work", "what data leaves my * network" — that should NOT be answered from the model's training * data. The docs corpus under config/mksite/docs/ is the source of * truth, and shipping it inside the MCP build (chunked + indexed) * gives agents a grounded answer in one tool call. * * Inputs * * topic — exact slug lookup (e.g. "faq/security/data-protection"). * Highest priority; bypasses search. * query — natural-language query for TF-IDF search. * category — narrow search to one category (faq / apps / engine / * api / config / manage). Combines with `query`. * max_results — cap on returned SearchResult[] (default 3). * * Output (envelope.data.payload) * * found — boolean. True when at least one result was found. * results — ranked SearchResult[] (capped at max_results). * similar_topics — when found=false, top-5 nearest topic slugs as a * "did you mean…" hint. * * The envelope itself is the standard chassis envelope so agents can * branch on status / read scope / cite canonical_url. */ import { z } from 'zod'; import { type SearchResult } from '../lib/product-kb/index.js'; import type { StructuredOutput } from '../lib/output-types.js'; /** * Tool input schema. `topic` / `query` / `category` are all optional * but at least one of `topic` / `query` must be present. The handler * surfaces an `error` envelope when both are missing. */ export declare const productQaSchema: { topic: z.ZodOptional; query: z.ZodOptional; category: z.ZodOptional; max_results: z.ZodOptional; depth: z.ZodOptional>; }; declare const productQaInputSchema: z.ZodObject<{ topic: z.ZodOptional; query: z.ZodOptional; category: z.ZodOptional; max_results: z.ZodOptional; depth: z.ZodOptional>; }, "strip", z.ZodTypeAny, { query?: string | undefined; category?: string | undefined; depth?: "full" | "short" | undefined; topic?: string | undefined; max_results?: number | undefined; }, { query?: string | undefined; category?: string | undefined; depth?: "full" | "short" | undefined; topic?: string | undefined; max_results?: number | undefined; }>; export type ProductQaInput = z.infer; /** * Tool payload shape (the value placed at envelope.data.payload). * Exported so tests and downstream consumers can type-check the * envelope without re-deriving it from the Zod schema. */ export interface ProductQaPayload { found: boolean; results?: SearchResult[]; answer?: string; citations?: ProductQaCitation[]; similar_topics?: string[]; resolved_mode: 'topic' | 'query' | 'none'; corpus_source: string; } /** * A compact doc citation: metadata only, no section body. Roughly 120 * bytes each, so several stay well under the short-response budget. */ export interface ProductQaCitation { topic: string; category: string; canonical_url: string; heading: string; } /** * Short-mode payload (depth='short', the default). Carries one grounded * answer plus citation metadata and ZERO section bodies, which is the * size fix: section text is emitted only on depth='full'. */ export interface ProductQaShortPayload { found: boolean; answer: string; citations: ProductQaCitation[]; resolved_mode: 'topic' | 'query'; corpus_source: string; } /** * Execute the product_qa tool. Returns a standard chassis envelope * with the payload described above. * * Exported for direct invocation from tests; the index.ts registration * wraps this in the standard chassis `wrap()` like other tools. */ export declare function executeProductQa(rawArgs: unknown): StructuredOutput; export {};