RegisterResourceTemplates registers all available resource templates with the server. The context is used for feature flag evaluation. Icons are automatically applied from the toolset metadata if not already set.
(ctx context.Context, s *mcp.Server, deps any)
| 224 | // The context is used for feature flag evaluation. |
| 225 | // Icons are automatically applied from the toolset metadata if not already set. |
| 226 | func (r *Inventory) RegisterResourceTemplates(ctx context.Context, s *mcp.Server, deps any) { |
| 227 | for _, res := range r.AvailableResourceTemplates(ctx) { |
| 228 | // Make a shallow copy to avoid mutating the original |
| 229 | templateCopy := res.Template |
| 230 | // Apply icons from toolset metadata if not already set |
| 231 | if len(templateCopy.Icons) == 0 { |
| 232 | templateCopy.Icons = res.Toolset.Icons() |
| 233 | } |
| 234 | s.AddResourceTemplate(&templateCopy, res.Handler(deps)) |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | // RegisterPrompts registers all available prompts with the server. |
| 239 | // The context is used for feature flag evaluation. |
no test coverage detected