MCPcopy
hub / github.com/github/github-mcp-server / RegisterResourceTemplates

Method RegisterResourceTemplates

pkg/inventory/registry.go:226–236  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

224// The context is used for feature flag evaluation.
225// Icons are automatically applied from the toolset metadata if not already set.
226func (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.

Callers 1

RegisterAllMethod · 0.95

Calls 3

IconsMethod · 0.80
HandlerMethod · 0.45

Tested by

no test coverage detected