/** * Extract a human-readable error string from an MCP isError result object. * * Shared utility — no side effects, no dependencies on other SDK modules — * so it can be imported from the neurolink.ts event loop, the telemetry * instrumentation (which loads earlier), and the MCP discovery layer without * creating circular imports. Any change to truncation or content-type parsing * must happen here and propagate to all three surfaces. */ export declare function extractMcpErrorText(raw: unknown): string; /** * MCP tools signal failure by RETURNING `{ isError: true, ... }`, not throwing, * so execute()'s try/catch never sees it. Returns a capped status message for * failures (undefined for success) for the caller to set the span error level. * * Generic over input shape: accepts either a result object or a JSON-stringified * envelope (different providers hand back different shapes), mirroring * `extractMcpErrorText`. A non-JSON string has no `isError` field, so it is * correctly treated as "not an error" (→ undefined). * * Layered on `extractMcpErrorText`: this adds the `isError === true` gate and * the human-readable "MCP tool returned isError: …" prefix, while the shared * helper owns the content parsing and the 500-char cap. When `isError` is set * but no readable text is present, falls back to a generic message. */ export declare function extractMcpToolErrorMessage(result: unknown): string | undefined; /** * Detect a tool result that REPORTS failure without throwing, for the native * loops' consecutive-failure breaker. Covers the two shapes NeuroLink itself * produces or forwards: * - MCP CallToolResult with `isError: true` (e.g. proxy-blocked tools) — * delegated to {@link extractMcpToolErrorMessage} * - our own `{ error: "..." }` payloads * Plain strings are never classified (too false-positive-prone). * Returns the error text, or null when the result looks like a success. */ export declare function extractToolFailureText(result: unknown): string | null;