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

Function getSearchOrReadFromContent

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

Source from the content-addressed store, hash-verified

242 * Returns { isSearch, isRead, isREPL } if it's a collapsible search/read, null otherwise.
243 */
244export function getSearchOrReadFromContent(
245 content: { type: string; name?: string; input?: unknown } | undefined,
246 tools: Tools,
247): {
248 isSearch: boolean
249 isRead: boolean
250 isList: boolean
251 isREPL: boolean
252 isMemoryWrite: boolean
253 isAbsorbedSilently: boolean
254 mcpServerName?: string
255 isBash?: boolean
256} | null {
257 if (content?.type === 'tool_use' && content.name) {
258 const info = getToolSearchOrReadInfo(content.name, content.input, tools)
259 if (info.isCollapsible || info.isREPL) {
260 return {
261 isSearch: info.isSearch,
262 isRead: info.isRead,
263 isList: info.isList,
264 isREPL: info.isREPL,
265 isMemoryWrite: info.isMemoryWrite,
266 isAbsorbedSilently: info.isAbsorbedSilently,
267 mcpServerName: info.mcpServerName,
268 isBash: info.isBash,
269 }
270 }
271 }
272 return null
273}
274
275/**
276 * Checks if a tool is a search/read operation (for backwards compatibility).

Callers 2

getSearchOrReadInfoFunction · 0.85
getCollapsibleToolInfoFunction · 0.85

Calls 1

getToolSearchOrReadInfoFunction · 0.85

Tested by

no test coverage detected