MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / withTextToolProtocol

Function withTextToolProtocol

src/llm/text-tool-protocol.ts:103–110  ·  view source on GitHub ↗
(messages: Message[], block: string)

Source from the content-addressed store, hash-verified

101 * No-op (returns the same array reference semantics, new array) when `block` is empty.
102 */
103export function withTextToolProtocol(messages: Message[], block: string): Message[] {
104 if (!block) return messages;
105 // Find the index just past the leading run of system messages.
106 let insertAt = 0;
107 while (insertAt < messages.length && messages[insertAt]!.role === 'system') insertAt++;
108 const protocolMsg: Message = { role: 'system', content: block };
109 return [...messages.slice(0, insertAt), protocolMsg, ...messages.slice(insertAt)];
110}

Callers 2

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected