@@ -21,14 +21,15 @@ type BleveIndex struct {
2121
2222// ToolDocument represents a tool document in the index
2323type ToolDocument struct {
24- ToolName string `json:"tool_name"` // Just the tool name (without server prefix)
25- FullToolName string `json:"full_tool_name"` // Complete server:tool format
26- ServerName string `json:"server_name"`
27- Description string `json:"description"`
28- ParamsJSON string `json:"params_json"`
29- Hash string `json:"hash"`
30- Tags string `json:"tags"`
31- SearchableText string `json:"searchable_text"` // Combined searchable content
24+ ToolName string `json:"tool_name"` // Just the tool name (without server prefix)
25+ FullToolName string `json:"full_tool_name"` // Complete server:tool format
26+ ServerName string `json:"server_name"`
27+ Description string `json:"description"`
28+ ParamsJSON string `json:"params_json"`
29+ OutputSchemaJSON string `json:"output_schema_json,omitempty"`
30+ Hash string `json:"hash"`
31+ Tags string `json:"tags"`
32+ SearchableText string `json:"searchable_text"` // Combined searchable content
3233}
3334
3435// NewBleveIndex creates a new Bleve index
@@ -147,14 +148,15 @@ func (b *BleveIndex) IndexTool(toolMeta *config.ToolMetadata) error {
147148 toolMeta .ParamsJSON )
148149
149150 doc := & ToolDocument {
150- ToolName : toolName ,
151- FullToolName : toolMeta .Name ,
152- ServerName : toolMeta .ServerName ,
153- Description : toolMeta .Description ,
154- ParamsJSON : toolMeta .ParamsJSON ,
155- Hash : toolMeta .Hash ,
156- Tags : "" , // Can be extended later
157- SearchableText : searchableText ,
151+ ToolName : toolName ,
152+ FullToolName : toolMeta .Name ,
153+ ServerName : toolMeta .ServerName ,
154+ Description : toolMeta .Description ,
155+ ParamsJSON : toolMeta .ParamsJSON ,
156+ OutputSchemaJSON : toolMeta .OutputSchemaJSON ,
157+ Hash : toolMeta .Hash ,
158+ Tags : "" , // Can be extended later
159+ SearchableText : searchableText ,
158160 }
159161
160162 // Use server:tool format as document ID for uniqueness
@@ -249,7 +251,7 @@ func (b *BleveIndex) SearchTools(queryStr string, limit int) ([]*config.SearchRe
249251 // Create search request
250252 searchReq := bleve .NewSearchRequest (boolQuery )
251253 searchReq .Size = limit
252- searchReq .Fields = []string {"tool_name" , "full_tool_name" , "server_name" , "description" , "params_json" , "hash" }
254+ searchReq .Fields = []string {"tool_name" , "full_tool_name" , "server_name" , "description" , "params_json" , "output_schema_json" , " hash" }
253255 searchReq .Highlight = bleve .NewHighlight ()
254256
255257 b .logger .Debug ("Searching tools with enhanced query" , zap .String ("query" , queryStr ), zap .Int ("limit" , limit ))
@@ -263,11 +265,12 @@ func (b *BleveIndex) SearchTools(queryStr string, limit int) ([]*config.SearchRe
263265 var results []* config.SearchResult
264266 for _ , hit := range searchResult .Hits {
265267 toolMeta := & config.ToolMetadata {
266- Name : getStringField (hit .Fields , "full_tool_name" ),
267- ServerName : getStringField (hit .Fields , "server_name" ),
268- Description : getStringField (hit .Fields , "description" ),
269- ParamsJSON : getStringField (hit .Fields , "params_json" ),
270- Hash : getStringField (hit .Fields , "hash" ),
268+ Name : getStringField (hit .Fields , "full_tool_name" ),
269+ ServerName : getStringField (hit .Fields , "server_name" ),
270+ Description : getStringField (hit .Fields , "description" ),
271+ ParamsJSON : getStringField (hit .Fields , "params_json" ),
272+ OutputSchemaJSON : getStringField (hit .Fields , "output_schema_json" ),
273+ Hash : getStringField (hit .Fields , "hash" ),
271274 }
272275
273276 results = append (results , & config.SearchResult {
@@ -306,14 +309,15 @@ func (b *BleveIndex) BatchIndex(tools []*config.ToolMetadata) error {
306309 toolMeta .ParamsJSON )
307310
308311 doc := & ToolDocument {
309- ToolName : toolName ,
310- FullToolName : toolMeta .Name ,
311- ServerName : toolMeta .ServerName ,
312- Description : toolMeta .Description ,
313- ParamsJSON : toolMeta .ParamsJSON ,
314- Hash : toolMeta .Hash ,
315- Tags : "" ,
316- SearchableText : searchableText ,
312+ ToolName : toolName ,
313+ FullToolName : toolMeta .Name ,
314+ ServerName : toolMeta .ServerName ,
315+ Description : toolMeta .Description ,
316+ ParamsJSON : toolMeta .ParamsJSON ,
317+ OutputSchemaJSON : toolMeta .OutputSchemaJSON ,
318+ Hash : toolMeta .Hash ,
319+ Tags : "" ,
320+ SearchableText : searchableText ,
317321 }
318322
319323 docID := fmt .Sprintf ("%s:%s" , toolMeta .ServerName , toolName )
@@ -348,7 +352,7 @@ func (b *BleveIndex) GetToolsByServer(serverName string) ([]*config.ToolMetadata
348352 // Create search request with high limit to get all tools
349353 searchReq := bleve .NewSearchRequest (query )
350354 searchReq .Size = 10000 // Maximum tools per server
351- searchReq .Fields = []string {"tool_name" , "full_tool_name" , "server_name" , "description" , "params_json" , "hash" }
355+ searchReq .Fields = []string {"tool_name" , "full_tool_name" , "server_name" , "description" , "params_json" , "output_schema_json" , " hash" }
352356
353357 b .logger .Debug ("Querying tools by server" , zap .String ("server" , serverName ))
354358
@@ -361,11 +365,12 @@ func (b *BleveIndex) GetToolsByServer(serverName string) ([]*config.ToolMetadata
361365 var tools []* config.ToolMetadata
362366 for _ , hit := range searchResult .Hits {
363367 toolMeta := & config.ToolMetadata {
364- Name : getStringField (hit .Fields , "full_tool_name" ),
365- ServerName : getStringField (hit .Fields , "server_name" ),
366- Description : getStringField (hit .Fields , "description" ),
367- ParamsJSON : getStringField (hit .Fields , "params_json" ),
368- Hash : getStringField (hit .Fields , "hash" ),
368+ Name : getStringField (hit .Fields , "full_tool_name" ),
369+ ServerName : getStringField (hit .Fields , "server_name" ),
370+ Description : getStringField (hit .Fields , "description" ),
371+ ParamsJSON : getStringField (hit .Fields , "params_json" ),
372+ OutputSchemaJSON : getStringField (hit .Fields , "output_schema_json" ),
373+ Hash : getStringField (hit .Fields , "hash" ),
369374 }
370375 tools = append (tools , toolMeta )
371376 }
0 commit comments