MCPcopy Create free account
hub / github.com/agentrpc/agentrpc / validateFunctionArgs

Function validateFunctionArgs

sdk-node/src/util.ts:17–32  ·  view source on GitHub ↗
(schema: any, args: unknown)

Source from the content-addressed store, hash-verified

15const MAX_NAME_LENGTH = 30;
16
17export const validateFunctionArgs = (schema: any, args: unknown) => {
18 try {
19 if (isZodType(schema)) {
20 schema.parse(args);
21 } else {
22 const ajv = new Ajv();
23
24 addFormats(ajv);
25 ajv.compile({
26 ...schema,
27 $schema: undefined,
28 });
29 ajv.validate(schema, args);
30 }
31 } catch (e: unknown) {}
32};
33
34export const validateServiceName = (name: string) => {
35 if (!ALLOWED_NAME_CHARACTERS.test(name)) {

Callers 1

processCallMethod · 0.90

Calls 1

isZodTypeFunction · 0.85

Tested by

no test coverage detected