MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / buildToolIdList

Function buildToolIdList

lib/messages/utils.ts:142–159  ·  view source on GitHub ↗
(state: SessionState, messages: WithParts[])

Source from the content-addressed store, hash-verified

140}
141
142export function buildToolIdList(state: SessionState, messages: WithParts[]): string[] {
143 const toolIds: string[] = []
144 for (const msg of messages) {
145 if (isMessageCompacted(state, msg)) {
146 continue
147 }
148 const parts = Array.isArray(msg.parts) ? msg.parts : []
149 if (parts.length > 0) {
150 for (const part of parts) {
151 if (part.type === "tool" && part.callID && part.tool) {
152 toolIds.push(part.callID)
153 }
154 }
155 }
156 }
157 state.toolIdList = toolIds
158 return toolIds
159}
160
161export const replaceBlockIdsWithBlocked = (text: string): string => {
162 return text.replace(DCP_BLOCK_ID_TAG_REGEX, "$1BLOCKED$2")

Callers 2

handleSweepCommandFunction · 0.90

Calls 1

isMessageCompactedFunction · 0.90

Tested by

no test coverage detected