MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / requireString

Function requireString

src/app/service/agent/core/tools/param_utils.ts:6–12  ·  view source on GitHub ↗
(args: Record<string, unknown>, name: string)

Source from the content-addressed store, hash-verified

4
5/** 获取必填字符串参数 */
6export function requireString(args: Record<string, unknown>, name: string): string {
7 const val = args[name];
8 if (val == null || typeof val !== "string" || val.trim() === "") {
9 throw new Error(`缺少必填参数 "${name}" 或类型不正确(需要非空字符串)`);
10 }
11 return val;
12}
13
14/** 获取必填数字参数 */
15export function requireNumber(args: Record<string, unknown>, name: string): number {

Callers 8

createTaskToolsFunction · 0.90
executeMethod · 0.90
createTabToolsFunction · 0.90
createExecuteScriptToolFunction · 0.90
executeMethod · 0.90
createOPFSToolsFunction · 0.90
createSubAgentToolFunction · 0.90
createAskUserToolFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected