( input: unknown, )
| 288 | * Returns undefined when OTEL_LOG_TOOL_DETAILS is not enabled. |
| 289 | */ |
| 290 | export function extractToolInputForTelemetry( |
| 291 | input: unknown, |
| 292 | ): string | undefined { |
| 293 | if (!isToolDetailsLoggingEnabled()) { |
| 294 | return undefined |
| 295 | } |
| 296 | const truncated = truncateToolInputValue(input) |
| 297 | let json = jsonStringify(truncated) |
| 298 | if (json.length > TOOL_INPUT_MAX_JSON_CHARS) { |
| 299 | json = json.slice(0, TOOL_INPUT_MAX_JSON_CHARS) + '…[truncated]' |
| 300 | } |
| 301 | return json |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Maximum length for file extensions to be logged. |
no test coverage detected