| 145 | } |
| 146 | |
| 147 | func (t *ToolSet) Tools(context.Context) ([]tools.Tool, error) { |
| 148 | var description string |
| 149 | if t.manager != nil { |
| 150 | description = t.manager.Description() |
| 151 | } |
| 152 | description = cmp.Or(description, fmt.Sprintf("Search project documents from %s to find relevant code or documentation. "+ |
| 153 | "Provide a natural language query describing what you need. "+ |
| 154 | "Returns the most relevant document chunks with file paths.", t.toolName)) |
| 155 | |
| 156 | return []tools.Tool{{ |
| 157 | Name: t.toolName, |
| 158 | Category: "knowledge", |
| 159 | Description: description, |
| 160 | Parameters: tools.MustSchemaFor[queryRAGArgs](), |
| 161 | OutputSchema: tools.MustSchemaFor[[]queryResult](), |
| 162 | Handler: tools.NewHandler(t.handleQueryRAG), |
| 163 | Annotations: tools.ToolAnnotations{ |
| 164 | ReadOnlyHint: true, |
| 165 | Title: "Query " + t.toolName, |
| 166 | }, |
| 167 | }}, nil |
| 168 | } |
| 169 | |
| 170 | func (t *ToolSet) handleQueryRAG(ctx context.Context, args queryRAGArgs) (*tools.ToolCallResult, error) { |
| 171 | if args.Query == "" { |