| 1 | package agent |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "encoding/json" |
| 6 | "sort" |
| 7 | |
| 8 | "reasonix/internal/tool" |
| 9 | ) |
| 10 | |
| 11 | func toolIdentity(reg *tool.Registry, ctx context.Context) ([]string, string) { |
| 12 | if reg == nil { |
| 13 | return nil, bytesHash(nil) |
| 14 | } |
| 15 | schemas := normalizeToolSchemas(reg.SchemasForContext(ctx)) |
| 16 | names := make([]string, 0, len(schemas)) |
| 17 | for _, schema := range schemas { |
| 18 | names = append(names, schema.Name) |
| 19 | } |
| 20 | sort.Strings(names) |
| 21 | data, _ := json.Marshal(schemas) |
| 22 | return names, bytesHash(data) |
| 23 | } |
| 24 |