/** * Content utilities for JSON sanitization and MIME type inference. * * Provides functions for safely converting JavaScript values to JSON-compatible * formats and inferring content types from file extensions. */ /** * Sanitize arbitrary JS values into JSON-safe objects. * * Handles: * - Functions and symbols → dropped (undefined) * - BigInt → string * - Date → ISO string * - Error → { name, message, stack } * - Map → plain object * - Set → array * - Circular references → dropped (undefined) * * @param value - Any JavaScript value * @returns JSON-safe version of the value * * @example * sanitizeToJson({ date: new Date(), fn: () => {} }) * // { date: '2024-01-01T00:00:00.000Z' } * * sanitizeToJson(new Map([['key', 'value']])) * // { key: 'value' } */ export declare function sanitizeToJson(value: unknown): unknown; /** * Walk a JSON-like value and return the first non-finite number encountered * (`Infinity`, `-Infinity`, or `NaN`), or `undefined` if all numbers are * finite. Used by the SDK to reject tool/resource output that would silently * be serialized as `null` by `JSON.stringify`. * * Cycles in the input tree are not expected (callers run sanitizeToJson * first, which drops them) but we guard with a WeakSet anyway. */ export declare function findNonFiniteNumber(value: unknown): { path: string; value: number; } | undefined; /** * Infer MIME type from file extension or content. * * @param uri - The URI or filename to infer from * @param content - Optional content to help infer type * @returns Inferred MIME type, defaults to 'text/plain' * * @example * inferMimeType('document.json') // 'application/json' * inferMimeType('image.png') // 'image/png' * inferMimeType('unknown', '{"key": "value"}') // 'application/json' * inferMimeType('unknown', '') // 'text/html' */ export declare function inferMimeType(uri: string, content?: unknown): string;