{"record":{"id":"6de4ac942c643e0e","repo":"siyuan-note/siyuan","slug":"config-inputschema-is-required","errorCode":null,"errorMessage":"config.inputSchema is required","messagePattern":"config\\.inputSchema is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/plugin/api_agent.go","lineNumber":105,"sourceCode":"\t\t\t\t\t\tif titleValue := configObj.Get(\"title\"); goja.IsString(titleValue) {\n\t\t\t\t\t\t\ttitle = titleValue.String()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif descriptionValue := configObj.Get(\"description\"); goja.IsString(descriptionValue) {\n\t\t\t\t\t\t\tdescription = strings.TrimSpace(descriptionValue.String())\n\t\t\t\t\t\t\tif description == \"\" {\n\t\t\t\t\t\t\t\terr = fmt.Errorf(\"config.description must not be empty\")\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = fmt.Errorf(\"config.description is required and must be a string\")\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif inputSchemaValue := configObj.Get(\"inputSchema\"); isJsValueNotNull(inputSchemaValue) {\n\t\t\t\t\t\t\tif inputSchema, err = jsCapabilitySchemaToGoSchema(rt, inputSchemaValue); err != nil {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = fmt.Errorf(\"config.inputSchema is required\")\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif outputSchemaValue := configObj.Get(\"outputSchema\"); isJsValueNotNull(outputSchemaValue) {\n\t\t\t\t\t\t\tif outputSchema, err = jsCapabilitySchemaToGoSchema(rt, outputSchemaValue); err != nil {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif effectsValue := configObj.Get(\"effects\"); isJsValueNotNull(effectsValue) {\n\t\t\t\t\t\t\tif effects, err = jsCapabilityEffectsToGoEffects(rt, effectsValue); err != nil {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif actionEffectsValue := configObj.Get(\"actionEffects\"); isJsValueNotNull(actionEffectsValue) {\n\t\t\t\t\t\t\tif actionEffects, err = jsCapabilityActionEffectsToGoEffects(rt, actionEffectsValue); err != nil {\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/plugin/api_agent.go#L87-L123","documentation":"Thrown by siyuan.agent.registerCapability when config.inputSchema is null/undefined (isJsValueNotNull returns false). The input schema is mandatory because it defines the JSON Schema the AI model uses to construct tool-call arguments — without it the model cannot invoke the capability.","triggerScenarios":"Passing config = { description: '...' } with no inputSchema key, or explicitly setting inputSchema to null/undefined.","commonSituations":"Plugin developer assumes inputSchema is optional; uses an older API version where it wasn't required; the config object was partially constructed and the schema branch was skipped.","solutions":["Add an inputSchema field to the config object — at minimum { type: 'object', properties: {} }","If the tool takes no parameters, use { type: 'object', properties: {} } as a no-arg schema"],"exampleFix":"// before\nawait siyuan.agent.registerCapability('myTool', {\n  description: 'Returns server status'\n}, handler);\n\n// after\nawait siyuan.agent.registerCapability('myTool', {\n  description: 'Returns server status',\n  inputSchema: { type: 'object', properties: {} }\n}, handler);","handlingStrategy":"validation","validationCode":"if (config.inputSchema == null) {\n  throw new Error('config.inputSchema is required');\n}\nawait siyuan.agent.registerCapability(name, config, handler);","typeGuard":"function hasInputSchema(config) {\n  return config != null && config.inputSchema != null\n    && typeof config.inputSchema === 'object';\n}","tryCatchPattern":null,"preventionTips":["Always provide an inputSchema, even for no-argument tools use { type: 'object', properties: {} }","Validate the config object has inputSchema before calling registerCapability"],"tags":["plugin","agent","capability","schema","validation","javascript"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}