import { type RequestContext } from '../../utils/internal/requestContext.js';
/**
 * Utility class for parsing XML strings.
 *
 * Lazily loads `fast-xml-parser` on first use (peer dependency — install with
 * `bun add fast-xml-parser`). The `XMLParser` instance is constructed once at first
 * call with `{ processEntities: false, htmlEntities: false }` and cached for subsequent
 * calls. Handles optional `<think>...</think>` blocks that some LLMs prepend to
 * structured output; the block's content is logged at debug level and stripped before
 * parsing.
 */
export declare class XmlParser {
    /**
     * Parses an XML string into a typed JavaScript object.
     *
     * This method is async because `fast-xml-parser` is loaded lazily on first call.
     * If the input begins with a `<think>...</think>` block, that block is stripped
     * and its content logged before parsing the remainder. The parser is configured with
     * `processEntities: false` and `htmlEntities: false` — entity references are passed
     * through as-is.
     *
     * @template T - The expected type of the parsed result. Defaults to `unknown`.
     * @param xmlString - The XML string to parse. May be prefixed with a `<think>` block.
     * @param context - Optional request context for correlated logging and error metadata.
     * @returns A promise resolving to the parsed object cast to `T`.
     * @throws {McpError} With code `ConfigurationError` if `fast-xml-parser` is not installed.
     * @throws {McpError} With code `ValidationError` if the string is empty after stripping
     *   the `<think>` block, or if `fast-xml-parser` throws during parsing.
     * @example
     * ```typescript
     * import { xmlParser } from '../../utils/parsing/xmlParser.js';
     *
     * const result = await xmlParser.parse<{ root: { key: string } }>('<root><key>value</key></root>');
     * console.log(result.root.key); // 'value'
     *
     * // LLM output with a <think> preamble
     * const fromLlm = await xmlParser.parse('<think>reasoning</think>\n<root><key>value</key></root>');
     * console.log(fromLlm); // { root: { key: 'value' } }
     * ```
     */
    parse<T = unknown>(xmlString: string, context?: RequestContext): Promise<T>;
}
/**
 * Singleton instance of {@link XmlParser}.
 *
 * Prefer this over constructing a new `XmlParser` directly. Lazily loads `fast-xml-parser`
 * on first call and caches the `XMLParser` instance, so there is no startup cost if XML
 * parsing is never used.
 *
 * @example
 * ```typescript
 * import { xmlParser } from '../../utils/parsing/xmlParser.js';
 *
 * // Basic parse
 * const result = await xmlParser.parse<{ root: { id: string } }>('<root><id>42</id></root>');
 * console.log(result.root.id); // '42'
 *
 * // With request context for correlated logging
 * import { requestContextService } from '../../utils/internal/requestContext.js';
 * const ctx = requestContextService.createRequestContext({ operation: 'parseResponse' });
 * const data = await xmlParser.parse<ApiResponse>(rawXml, ctx);
 *
 * // Strips LLM <think> preamble automatically
 * const fromLlm = await xmlParser.parse('<think>let me think</think>\n<root><key>value</key></root>');
 * console.log(fromLlm); // { root: { key: 'value' } }
 * ```
 */
export declare const xmlParser: XmlParser;
//# sourceMappingURL=xmlParser.d.ts.map