Skip to main content
POST
/
v1
/
tools
/
database-query
Database Query
curl --request POST \
  --url https://{base_url}/gpt/v1/tools/database-query \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "artifacts": [
    {
      "value": "<string>",
      "type": "file"
    }
  ]
}
'
{
"content": [
{
"type": "text",
"text": "The total revenue for Q4 was $3.5M, with the highest contributions from the Sales department."
}
],
"is_error": false
}

Body

application/json

Request body for querying connected SQL databases using natural language. Requires at least one SQL database artifact in the tool context.

Request body for database query using the tool.

query
string
required

The natural language query to run against connected databases.

Example:

"What were the Q4 revenue trends?"

artifacts
(FileArtifact · object | UriArtifact · object | TextArtifact · object | IngestedArtifact · object | SqlDatabaseArtifact · object)[]
required

List of SQL database artifacts to query against. At least one artifact of type 'sql_database' is required.

Input for base64 encoded files.

Response

Database query completed successfully.

Response returned from tool-based operations.

content
(TextBlock · object | ImageBlock · object | AudioBlock · object | BinaryBlock · object | ResourceLinkBlock · object | ResourceBlock · object | SourceBlock · object | ToolUseBlock · object | ThinkingBlock · object | TLDRBlock · object)[]
required

List of content blocks generated by the tool. Blocks can include plain text, citations, source attributions, or images.

Text content block containing natural language text.

is_error
boolean
default:false

True if the tool encountered an error during execution.