AI tool definitions

The three tools the Qaf chat agent can call, with the exact descriptions and JSON Schemas sent to the model. Typical flow: lookup_catalog to resolve a named author or book, search for passages, then expand for surrounding context.

lookup_catalog

Resolve a named author or book to canonical catalog IDs before filtering search. Returns up to five candidates, their metadata and matchScore (0–1; higher means a closer name match). Select genres directly from the search tool's filters.genres enum. These records identify sources; they are not citation evidence. Disambiguate using the question, or ask the user when ambiguous.

Input

FieldTypeNotes
typeenum: author | book
querystringmin len 1, max len 200
labelstringA concise, human-readable description of the catalog lookup intent in at most 5 words, in the user's UI language. Shown in the UI only; does NOT affect catalog matching. min len 1, max len 200
Input JSON Schema
{
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "author",
        "book"
      ]
    },
    "query": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "label": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "A concise, human-readable description of the catalog lookup intent in at most 5 words, in the user's UI language. Shown in the UI only; does NOT affect catalog matching."
    }
  },
  "required": [
    "type",
    "query",
    "label"
  ]
}
Output JSON Schema
{
  "maxItems": 5,
  "type": "array",
  "items": {
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "author"
          },
          "id": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "label": {
            "type": "string"
          },
          "deathYearAH": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "deathInexactLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "matchScore": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "type",
          "id",
          "label",
          "deathYearAH",
          "deathInexactLabel",
          "matchScore"
        ],
        "additionalProperties": false
      },
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "book"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "label": {
            "type": "string"
          },
          "authorId": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "authorLabel": {
            "type": "string"
          },
          "deathYearAH": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "deathInexactLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "categoryId": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "matchScore": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "type",
          "id",
          "label",
          "authorId",
          "authorLabel",
          "deathYearAH",
          "deathInexactLabel",
          "categoryId",
          "matchScore"
        ],
        "additionalProperties": false
      }
    ]
  }
}

expand

Read up to two neighboring passages on each side of a retrieved passage. Copy book_id, version_id and sequence_number from that passage; do not guess coordinates. Citation IDs in earlier answers are not expand coordinates; search again if the passage coordinates are unavailable.

Input

FieldTypeNotes
book_idstring (uuid)The book id to expand.
version_idintegerThe version id to expand. > 0
sequence_numberintegerThe sequence number of the chunk to expand. ≥ 0
Input JSON Schema
{
  "type": "object",
  "properties": {
    "book_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      "description": "The book id to expand."
    },
    "version_id": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "description": "The version id to expand."
    },
    "sequence_number": {
      "type": "integer",
      "minimum": 0,
      "description": "The sequence number of the chunk to expand."
    }
  },
  "required": [
    "book_id",
    "version_id",
    "sequence_number"
  ]
}
Output JSON Schema
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "text": {
        "type": "string"
      },
      "footnotes": {
        "type": "string"
      },
      "pages": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "vol": {
              "type": [
                "string",
                "null"
              ]
            },
            "page": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "vol",
            "page"
          ],
          "additionalProperties": false
        }
      },
      "book_id": {
        "type": "string"
      },
      "author_id": {
        "type": "number"
      },
      "version_id": {
        "type": "number"
      },
      "sequence_number": {
        "type": "integer",
        "minimum": 0
      },
      "book_name": {
        "type": "string"
      },
      "author_name": {
        "type": "string"
      }
    },
    "required": [
      "id",
      "text",
      "pages",
      "book_id",
      "author_id",
      "version_id",
      "book_name",
      "author_name"
    ],
    "additionalProperties": false
  }
}

What the model sees in results