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

Function validateArgs

lib/compress/message-utils.ts:30–55  ·  view source on GitHub ↗
(args: CompressMessageToolArgs)

Source from the content-addressed store, hash-verified

28}
29
30export function validateArgs(args: CompressMessageToolArgs): void {
31 if (typeof args.topic !== "string" || args.topic.trim().length === 0) {
32 throw new Error("topic is required and must be a non-empty string")
33 }
34
35 if (!Array.isArray(args.content) || args.content.length === 0) {
36 throw new Error("content is required and must be a non-empty array")
37 }
38
39 for (let index = 0; index < args.content.length; index++) {
40 const entry = args.content[index]
41 const prefix = `content[${index}]`
42
43 if (typeof entry?.messageId !== "string" || entry.messageId.trim().length === 0) {
44 throw new Error(`${prefix}.messageId is required and must be a non-empty string`)
45 }
46
47 if (typeof entry?.topic !== "string" || entry.topic.trim().length === 0) {
48 throw new Error(`${prefix}.topic is required and must be a non-empty string`)
49 }
50
51 if (typeof entry?.summary !== "string" || entry.summary.trim().length === 0) {
52 throw new Error(`${prefix}.summary is required and must be a non-empty string`)
53 }
54 }
55}
56
57export function formatResult(
58 processedCount: number,

Callers 1

executeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected