siyuan-note/siyuan · error

config.inputSchema is required

Error message

config.inputSchema is required

What it means

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.

Source

Thrown at kernel/plugin/api_agent.go:105

						if titleValue := configObj.Get("title"); goja.IsString(titleValue) {
							title = titleValue.String()
						}
						if descriptionValue := configObj.Get("description"); goja.IsString(descriptionValue) {
							description = strings.TrimSpace(descriptionValue.String())
							if description == "" {
								err = fmt.Errorf("config.description must not be empty")
								return
							}
						} else {
							err = fmt.Errorf("config.description is required and must be a string")
							return
						}
						if inputSchemaValue := configObj.Get("inputSchema"); isJsValueNotNull(inputSchemaValue) {
							if inputSchema, err = jsCapabilitySchemaToGoSchema(rt, inputSchemaValue); err != nil {
								return
							}
						} else {
							err = fmt.Errorf("config.inputSchema is required")
							return
						}
						if outputSchemaValue := configObj.Get("outputSchema"); isJsValueNotNull(outputSchemaValue) {
							if outputSchema, err = jsCapabilitySchemaToGoSchema(rt, outputSchemaValue); err != nil {
								return
							}
						}
						if effectsValue := configObj.Get("effects"); isJsValueNotNull(effectsValue) {
							if effects, err = jsCapabilityEffectsToGoEffects(rt, effectsValue); err != nil {
								return
							}
						}
						if actionEffectsValue := configObj.Get("actionEffects"); isJsValueNotNull(actionEffectsValue) {
							if actionEffects, err = jsCapabilityActionEffectsToGoEffects(rt, actionEffectsValue); err != nil {
								return
							}
						}
					}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Add an inputSchema field to the config object — at minimum { type: 'object', properties: {} }
  2. If the tool takes no parameters, use { type: 'object', properties: {} } as a no-arg schema

Example fix

// before
await siyuan.agent.registerCapability('myTool', {
  description: 'Returns server status'
}, handler);

// after
await siyuan.agent.registerCapability('myTool', {
  description: 'Returns server status',
  inputSchema: { type: 'object', properties: {} }
}, handler);
Defensive patterns

Strategy: validation

Validate before calling

if (config.inputSchema == null) {
  throw new Error('config.inputSchema is required');
}
await siyuan.agent.registerCapability(name, config, handler);

Type guard

function hasInputSchema(config) {
  return config != null && config.inputSchema != null
    && typeof config.inputSchema === 'object';
}

Prevention

When it happens

Trigger: Passing config = { description: '...' } with no inputSchema key, or explicitly setting inputSchema to null/undefined.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/6de4ac942c643e0e. Report an issue: GitHub.