MCPcopy Index your code
hub / github.com/anomalyco/opencode / mcpResourceBase64Size

Function mcpResourceBase64Size

packages/opencode/src/session/prompt.ts:84–88  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

82const STRUCTURED_OUTPUT_SYSTEM_PROMPT = `IMPORTANT: The user has requested structured output. You MUST use the StructuredOutput tool to provide your final response. Do NOT respond with plain text - you MUST call the StructuredOutput tool with your answer formatted according to the schema.`
83
84function mcpResourceBase64Size(value: string) {
85 const trimmed = value.replace(/\s/g, "")
86 const padding = trimmed.endsWith("==") ? 2 : trimmed.endsWith("=") ? 1 : 0
87 return Math.max(0, Math.floor((trimmed.length * 3) / 4) - padding)
88}
89
90function formatMcpResourceBytes(value: number) {
91 if (value < 1024) return `${value} B`

Callers 1

prompt.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected