MCPcopy Index your code
hub / github.com/codeaashu/claude-code / addToolContentEvent

Function addToolContentEvent

src/utils/telemetry/sessionTracing.ts:747–776  ·  view source on GitHub ↗
(
  eventName: string,
  attributes: Record<string, string | number | boolean>,
)

Source from the content-addressed store, hash-verified

745 * Truncates content if it exceeds MAX_CONTENT_SIZE.
746 */
747export function addToolContentEvent(
748 eventName: string,
749 attributes: Record<string, string | number | boolean>,
750): void {
751 if (!isAnyTracingEnabled() || !isToolContentLoggingEnabled()) {
752 return
753 }
754
755 const currentSpanCtx = toolContext.getStore()
756 if (!currentSpanCtx) {
757 return
758 }
759
760 // Truncate string attributes that might be large
761 const processedAttributes: Record<string, string | number | boolean> = {}
762 for (const [key, value] of Object.entries(attributes)) {
763 if (typeof value === 'string') {
764 const { content, truncated } = truncateContent(value)
765 processedAttributes[key] = content
766 if (truncated) {
767 processedAttributes[`${key}_truncated`] = true
768 processedAttributes[`${key}_original_length`] = value.length
769 }
770 } else {
771 processedAttributes[key] = value
772 }
773 }
774
775 currentSpanCtx.span.addEvent(eventName, processedAttributes)
776}
777
778export function getCurrentSpan(): Span | null {
779 if (!isAnyTracingEnabled()) {

Callers 1

Calls 4

isAnyTracingEnabledFunction · 0.85
truncateContentFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected