File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -388,9 +388,18 @@ export async function createElasticsearchMcpServer(
388388 : result . hits . total ?. value || 0
389389 } , showing ${ result . hits . hits . length } from position ${ from } `,
390390 } ;
391+ // Check if there are any aggregations in the result and include them
392+ const aggregationsFragment = result . aggregations
393+ ? {
394+ type : "text" as const ,
395+ text : `Aggregations: ${ JSON . stringify ( result . aggregations , null , 2 ) } ` ,
396+ }
397+ : null ;
391398
392399 return {
393- content : [ metadataFragment , ...contentFragments ] ,
400+ content : aggregationsFragment
401+ ? [ metadataFragment , aggregationsFragment , ...contentFragments ]
402+ : [ metadataFragment , ...contentFragments ] ,
394403 } ;
395404 } catch ( error ) {
396405 console . error (
You can’t perform that action at this time.
0 commit comments