Return Types
By default, the florentine_ask tool returns an aggregation result for the question provided. However, you can choose between any combination of the following three steps:
- Aggregation Generation: The question is converted into a MongoDB aggregation query.
- Query Execution: The aggregation runs against the database using the connection string you provided.
- Answer Generation: The structured result is transformed into a natural language answer.
Providing Return Types
You have two options to include a returnTypes array:
- As the
RETURN_TYPESenvvariable in your MCP setup config (possible instaticanddynamicmode) - As the
returnTypesparameter to theflorentine_asktool (possible only indynamicmode)
Provide as ENV variable
Provide the variable value as a stringified json array:
"env": {
"RETURN_TYPES": "[\"result\"]"
}Provide as tool parameter
Provide the variable value as a json array:
{
"returnTypes": ["result"]
}Return Types Configuration
You can choose which of these steps you want returned by specifying a returnTypes array with any combination of:
returnTypes Value | Description | Expected Keys in Response |
|---|---|---|
"aggregation" | Returns the generated MongoDB aggregation pipeline, the database and collection used and a confidence score on a scale from 0 to 10 on how confident the AI is that the aggregation will answer the question correct. | confidence, database, collection, aggregation |
"result" | Returns the raw query results from the executed aggregation. | result |
"answer" | Returns a natural language response based on the results from the executed aggregation. | answer |
Example returning all three steps
Imagine a tabletennis collection that records the results of the matches of two players.
Asking the question Who won the last match? with these florentine_ask tool parameters:
{
"question": "Who won the last match?",
"returnTypes": ["aggregation", "result", "answer"]
}The response then looks like this:
{
"content": [
{ type: 'text',
text: '{
"database": "samples",
"collection": "tabletennis",
"aggregation": [
{ "$sort": { "year": -1, "matchInYear": -1 } },
{ "$limit": 1 },
{
"$project": {
"winner": {
"$cond": {
"if": { "$eq": ["$matchwinner", "home"] },
"then": "$players.home",
"else": "$players.away"
}
}
}
}
],
"result": [{ "_id": "67d352056d3ef0f2281524cf", "winner": "Frank" }],
"answer": "Frank won the last match. According to our records, he emerged as the winner, highlighting his strong performance in that game."
}'
}
],
"isError": false
}Please note
The API behind the MCP server only executes the steps neccessary, so i.e. if you only provide aggregation in the returnTypes, the aggregation is not executed and no natural language answer generated, which increases the response time.