cassandra-cql

A “cassandra-cql” tool executes a pre-defined CQL statement against a Cassandra database.

About

A cassandra-cql tool executes a pre-defined CQL statement against a Cassandra database. It’s compatible with any of the following sources:

The specified CQL statement is executed as a prepared statement, and expects parameters in the CQL query to be in the form of placeholders ?.

Example

Note: This tool uses parameterized queries to prevent CQL injections. Query parameters can be used as substitutes for arbitrary expressions. Parameters cannot be used as substitutes for keyspaces, table names, column names, or other parts of the query.

tools:
  search_users_by_email:
    kind: cassandra-cql
    source: my-cassandra-cluster
    statement: |
      SELECT user_id, email, first_name, last_name, created_at 
      FROM users 
      WHERE email = ?
    description: |
      Use this tool to retrieve specific user information by their email address.
      Takes an email address and returns user details including user ID, email, 
      first name, last name, and account creation timestamp.
      Do NOT use this tool with a user ID or other identifiers.
      Example:
      {{
          "email": "user@example.com",
      }}
    parameters:
      - name: email
        type: string
        description: User's email address

Example with Template Parameters

Note: This tool allows direct modifications to the CQL statement, including keyspaces, table names, and column names. This makes it more vulnerable to CQL injections. Using basic parameters only (see above) is recommended for performance and safety reasons. For more details, please check templateParameters.

tools:
  list_keyspace_table:
    kind: cassandra-cql
    source: my-cassandra-cluster
    statement: |
      SELECT * FROM {{.keyspace}}.{{.tableName}};
    description: |
      Use this tool to list all information from a specific table in a keyspace.
      Example:
      {{
          "keyspace": "my_keyspace",
          "tableName": "users",
      }}
    templateParameters:
      - name: keyspace
        type: string
        description: Keyspace containing the table
      - name: tableName
        type: string
        description: Table to select from

Reference

fieldtyperequireddescription
kindstringtrueMust be “cassandra-cql”.
sourcestringtrueName of the source the CQL should execute on.
descriptionstringtrueDescription of the tool that is passed to the LLM.
statementstringtrueCQL statement to execute.
authRequired[]stringfalseList of authentication requirements for the source.
parametersparametersfalseList of parameters that will be inserted into the CQL statement.
templateParameterstemplateParametersfalseList of templateParameters that will be inserted into the CQL statement before executing prepared statement.