MCPcopy Create free account
hub / github.com/simstudioai/sim / eventToContent

Function eventToContent

apps/sim/connectors/google-calendar/google-calendar.ts:110–147  ·  view source on GitHub ↗

* Builds a readable content string from a calendar event.

(event: CalendarEvent)

Source from the content-addressed store, hash-verified

108 * Builds a readable content string from a calendar event.
109 */
110function eventToContent(event: CalendarEvent): string {
111 const parts: string[] = []
112
113 parts.push(`Event: ${event.summary || 'Untitled Event'}`)
114
115 if (isAllDayEvent(event)) {
116 parts.push(`Date: ${formatEventTime(event.start)} (All Day)`)
117 } else {
118 parts.push(`Date: ${formatEventTime(event.start)} - ${formatEventTime(event.end)}`)
119 }
120
121 if (event.location) {
122 parts.push(`Location: ${event.location}`)
123 }
124
125 const organizer = formatOrganizer(event.organizer)
126 if (organizer) {
127 parts.push(`Organizer: ${organizer}`)
128 }
129
130 const attendees = formatAttendees(event.attendees)
131 if (attendees) {
132 parts.push(`Attendees: ${attendees}`)
133 }
134
135 if (event.description) {
136 parts.push('')
137 parts.push('Description:')
138 parts.push(
139 event.description
140 .replace(/<[^>]*>/g, ' ')
141 .replace(/\s+/g, ' ')
142 .trim()
143 )
144 }
145
146 return parts.join('\n')
147}
148
149/**
150 * Computes the default time range boundaries: 30 days in the past to 30 days in the future.

Callers 1

eventToDocumentFunction · 0.85

Calls 7

isAllDayEventFunction · 0.85
formatEventTimeFunction · 0.85
formatOrganizerFunction · 0.85
formatAttendeesFunction · 0.85
joinMethod · 0.80
replaceMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected