/** * @blankstate/mcp - Tool Wrapper * * Core logic for wrapping tool calls with Protocol and Metric validation. * * Supports: * - Protocols: Direct sensor calls via /api/v1/sense (pure measurement) * - Metrics: Aggregated protocol calls (combined with weights) * - Session context: Temporal analysis for Protocol 1.5+ */ import type { BlankstateConfig, BlockedResult, FeedbackAttachment, AuditEntry } from '../types/index.js'; /** * Tool wrapper instance that handles Protocol and Metric validation */ export declare class ToolWrapper { private readonly config; private readonly ibf; private readonly auditLog; private readonly sessionContext; constructor(config: BlankstateConfig); /** * Wrap a tool call with Protocol and Metric validation * * Returns either: * - { blocked: true, result: BlockedResult } if blocked * - { blocked: false, feedback?: FeedbackAttachment[], audit?: AuditEntry[] } if allowed */ wrapToolCall(toolName: string, args: unknown): Promise; /** * Add content to session context buffer */ private addToSessionContext; /** * Get current session context */ private getSessionContext; /** * Clear session context (e.g., on session reset) */ clearSessionContext(): void; /** * Evaluate content against multiple Protocols using /api/v1/sense */ private evaluateProtocols; /** * Check if any Protocol in block mode should block execution */ private processProtocolBlockMode; /** * Collect feedback from Protocols in feedback mode */ private processProtocolFeedbackMode; /** * Evaluate content against multiple Metrics * * For each Metric: * 1. Call /api/v1/sense for each protocol in the metric * 2. Aggregate the scores using the configured calculation method */ private evaluateMetrics; /** * Calculate the aggregated metric score from protocol contributions */ private calculateMetricScore; /** * Check if any Metric in block mode should block execution */ private processMetricBlockMode; /** * Collect feedback from Metrics in feedback mode */ private processMetricFeedbackMode; /** * Log an audit entry */ private logAuditEntry; /** * Get audit log */ getAuditLog(): AuditEntry[]; /** * Clear audit log */ clearAuditLog(): void; } /** * Result of wrapping a tool call */ export interface WrapResult { blocked: boolean; result?: BlockedResult; feedback?: FeedbackAttachment[]; audit?: AuditEntry[]; } /** * Create a tool wrapper instance */ export declare function createToolWrapper(config: BlankstateConfig): ToolWrapper; //# sourceMappingURL=wrapper.d.ts.map