| 225 | } |
| 226 | |
| 227 | func lowerInputPropertyNames(inputSchema any) []string { |
| 228 | if inputSchema == nil { |
| 229 | return nil |
| 230 | } |
| 231 | |
| 232 | // From the server, this is commonly a *jsonschema.Schema. |
| 233 | if schema, ok := inputSchema.(*jsonschema.Schema); ok { |
| 234 | if len(schema.Properties) == 0 { |
| 235 | return nil |
| 236 | } |
| 237 | out := make([]string, 0, len(schema.Properties)) |
| 238 | for prop := range schema.Properties { |
| 239 | out = append(out, strings.ToLower(prop)) |
| 240 | } |
| 241 | return out |
| 242 | } |
| 243 | |
| 244 | // From the client (or when unmarshaled), schemas arrive as map[string]any. |
| 245 | if schema, ok := inputSchema.(map[string]any); ok { |
| 246 | propsAny, ok := schema["properties"] |
| 247 | if !ok { |
| 248 | return nil |
| 249 | } |
| 250 | props, ok := propsAny.(map[string]any) |
| 251 | if !ok || len(props) == 0 { |
| 252 | return nil |
| 253 | } |
| 254 | out := make([]string, 0, len(props)) |
| 255 | for prop := range props { |
| 256 | out = append(out, strings.ToLower(prop)) |
| 257 | } |
| 258 | return out |
| 259 | } |
| 260 | |
| 261 | return nil |
| 262 | } |
| 263 | |
| 264 | type matchTracker struct { |
| 265 | list []string |