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

Function optionalString

packages/opencode/src/session/tools.ts:503–508  ·  view source on GitHub ↗
(args: Record<string, unknown>, key: string)

Source from the content-addressed store, hash-verified

501}
502
503function optionalString(args: Record<string, unknown>, key: string) {
504 const value = args[key]
505 if (value === undefined || value === null || value === "") return undefined
506 if (typeof value !== "string") throw new Error(`${key} must be a string`)
507 return value
508}
509
510function requiredString(args: Record<string, unknown>, key: string) {
511 const value = optionalString(args, key)

Callers 2

requiredStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected