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

Function describeFileReadTarget

apps/sim/lib/copilot/tools/client/store-utils.ts:138–150  ·  view source on GitHub ↗
(segments: string[])

Source from the content-addressed store, hash-verified

136}
137
138function describeFileReadTarget(segments: string[]): string {
139 const lastSegment = segments[segments.length - 1] || ''
140 const facetLabel = FILE_FACET_LABELS[lastSegment]
141 // Treat the suffix as a facet only when a real file name precedes it; otherwise
142 // the leaf is the file itself (e.g. a file literally named "content").
143 if (facetLabel !== undefined && segments.length > 2) {
144 const fileName = segments[segments.length - 2]
145 return facetLabel ? `${facetLabel} ${fileName}` : fileName
146 }
147 // Show just the file name, not the folder path — these are glanceable status
148 // lines, and the other resource types already render the leaf only.
149 return lastSegment
150}
151
152function getLeafResourceSegment(segments: string[]): string {
153 const lastSegment = segments[segments.length - 1] || ''

Callers 1

describeReadTargetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected