MCPcopy
hub / github.com/codeaashu/claude-code / messageText

Function messageText

web/lib/search/client-search.ts:43–59  ·  view source on GitHub ↗

* Extract plain-text content from a message for indexing.

(content: Conversation["messages"][number]["content"])

Source from the content-addressed store, hash-verified

41 * Extract plain-text content from a message for indexing.
42 */
43function messageText(content: Conversation["messages"][number]["content"]): string {
44 if (typeof content === "string") return content;
45 if (!Array.isArray(content)) return "";
46
47 return content
48 .map((block) => {
49 if (block.type === "text") return block.text;
50 if (block.type === "tool_use") return `${block.name} ${JSON.stringify(block.input)}`;
51 if (block.type === "tool_result") {
52 return typeof block.content === "string"
53 ? block.content
54 : extractTextContent(block.content);
55 }
56 return "";
57 })
58 .join(" ");
59}
60
61/**
62 * Run a client-side full-text search over an array of conversations.

Callers 1

clientSearchFunction · 0.85

Calls 1

extractTextContentFunction · 0.90

Tested by

no test coverage detected