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

Function replaceOutputFormatWithXml

src/utils/permissions/yoloClassifier.ts:648–664  ·  view source on GitHub ↗

* Replace the tool_use output format instruction with XML format. * Finds the last line of the prompt ("Use the classify_result tool...") * and replaces it with XML output instructions.

(systemPrompt: string)

Source from the content-addressed store, hash-verified

646 * and replaces it with XML output instructions.
647 */
648function replaceOutputFormatWithXml(systemPrompt: string): string {
649 const toolUseLine =
650 'Use the classify_result tool to report your classification.'
651 const xmlFormat = [
652 '## Output Format',
653 '',
654 'If the action should be blocked:',
655 '<block>yes</block><reason>one short sentence</reason>',
656 '',
657 'If the action should be allowed:',
658 '<block>no</block>',
659 '',
660 'Do NOT include a <reason> tag when the action is allowed.',
661 'Your ENTIRE response MUST begin with <block>. Do NOT output any analysis, reasoning, or commentary before <block>. No "Looking at..." or similar preamble.',
662 ].join('\n')
663 return systemPrompt.replace(toolUseLine, xmlFormat)
664}
665
666/**
667 * Thinking config for classifier calls. The classifier wants short text-only

Callers 1

classifyYoloActionXmlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected