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