Documentation

AI Tools Schema

AI tools are dynamic database-defined functions that the assistant can call with validated parameters.

Tool record fields

  • name: unique tool identifier.
  • method_name: method exposed to the AI, optional fallback to name.
  • description: instruction text used by the model.
  • sql_query: SELECT query with positional placeholders.
  • parameters_schema: JSON Schema object for parameters.
  • active: enables or disables the tool.

Critical rules

  • Property order in parameters_schema must match placeholder order in sql_query.
  • Declared parameter types must align with SQL binding expectations.
  • parameters_schema must be valid JSON Schema of type object.

Validation checklist

  • Reject invalid JSON in parameters_schema.
  • Verify placeholder count against schema properties.
  • Keep name unique at repository level.
  • Use method_name fallback when blank.

Best practices

  • Write clear descriptions so the model chooses the right tool.
  • Use descriptive names, avoid generic labels.
  • Always use placeholders instead of string interpolation.
  • Test every query with realistic inputs and edge cases.