package aitools // Small helpers to build JSON Schema objects for tool input definitions without // verbose map literals. The shapes match the subset OpenAI function-calling and // Anthropic tool input_schema accept (type object with properties + required). func objectSchema(props map[string]any, required ...string) map[string]any { s := map[string]any{ "type": "object", "properties": props, "additionalProperties": false, } if len(required) > 0 { s["required"] = required } return s } func strProp(desc string) map[string]any { return map[string]any{"type": "string", "description": desc} } func enumProp(desc string, values ...string) map[string]any { vals := make([]any, len(values)) for i, v := range values { vals[i] = v } return map[string]any{"type": "string", "description": desc, "enum": vals} } func intProp(desc string) map[string]any { return map[string]any{"type": "integer", "description": desc} } func boolProp(desc string) map[string]any { return map[string]any{"type": "boolean", "description": desc} } func arrProp(desc string, items map[string]any) map[string]any { return map[string]any{"type": "array", "description": desc, "items": items} } // objProp is a nested free-form object (e.g. custom_field_updates), values are // strings unless a stricter shape is given. func objProp(desc string) map[string]any { return map[string]any{ "type": "object", "description": desc, "additionalProperties": map[string]any{"type": "string"}, } }