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

Function describeReadTarget

apps/sim/lib/copilot/tools/client/store-utils.ts:98–124  ·  view source on GitHub ↗
(path: string | undefined)

Source from the content-addressed store, hash-verified

96}
97
98function describeReadTarget(path: string | undefined): string | undefined {
99 if (!path) return undefined
100
101 const segments = path
102 .split('/')
103 .map((segment) => segment.trim())
104 .filter(Boolean)
105 .map(decodeVfsSegmentSafe)
106
107 if (segments.length === 0) return undefined
108
109 const resourceType = VFS_DIR_TO_RESOURCE[segments[0]]
110 if (!resourceType) {
111 return stripExtension(segments[segments.length - 1])
112 }
113
114 if (resourceType === 'file') {
115 return describeFileReadTarget(segments)
116 }
117
118 if (resourceType === 'workflow') {
119 return stripExtension(getLeafResourceSegment(segments))
120 }
121
122 const resourceName = segments[1] || segments[segments.length - 1]
123 return stripExtension(resourceName)
124}
125
126// A workspace file is addressed as a directory of facets in the VFS
127// (files/{...path}/{name}/{facet}). `content` is the default facet — reading a

Callers 1

specialToolDisplayFunction · 0.85

Calls 3

describeFileReadTargetFunction · 0.85
getLeafResourceSegmentFunction · 0.85
stripExtensionFunction · 0.70

Tested by

no test coverage detected