MCPcopy Create free account
hub / github.com/Noumena-Network/code / getSearchOrReadFromContent

Function getSearchOrReadFromContent

src/utils/collapseReadSearch.ts:262–291  ·  view source on GitHub ↗
(
  content: { type: string; name?: string; input?: unknown } | undefined,
  tools: Tools,
)

Source from the content-addressed store, hash-verified

260 * Returns { isSearch, isRead, isREPL } if it's a collapsible search/read, null otherwise.
261 */
262export function getSearchOrReadFromContent(
263 content: { type: string; name?: string; input?: unknown } | undefined,
264 tools: Tools,
265): {
266 isSearch: boolean
267 isRead: boolean
268 isList: boolean
269 isREPL: boolean
270 isMemoryWrite: boolean
271 isAbsorbedSilently: boolean
272 mcpServerName?: string
273 isBash?: boolean
274} | null {
275 if (content?.type === 'tool_use' && content.name) {
276 const info = getToolSearchOrReadInfo(content.name, content.input, tools)
277 if (info.isCollapsible || info.isREPL) {
278 return {
279 isSearch: info.isSearch,
280 isRead: info.isRead,
281 isList: info.isList,
282 isREPL: info.isREPL,
283 isMemoryWrite: info.isMemoryWrite,
284 isAbsorbedSilently: info.isAbsorbedSilently,
285 mcpServerName: info.mcpServerName,
286 isBash: info.isBash,
287 }
288 }
289 }
290 return null
291}
292
293/**
294 * Checks if a tool is a search/read operation (for backwards compatibility).

Callers 1

getSearchOrReadInfoFunction · 0.85

Calls 1

getToolSearchOrReadInfoFunction · 0.85

Tested by

no test coverage detected