buildStaticInventory pre-filters the full tool/resource/prompt universe using the static config (toolsets, read-only, --tools, --exclude-tools). It does NOT install a feature checker: HTTP feature flags can come from per-request context (/insiders, X-MCP-Features), so dual-name feature variants — fo
(cfg *ServerConfig, t translations.TranslationHelperFunc)
| 332 | // inventory, which then installs a checker and resolves the flag before |
| 333 | // registering tools with the MCP server. |
| 334 | func buildStaticInventory(cfg *ServerConfig, t translations.TranslationHelperFunc) ([]inventory.ServerTool, []inventory.ServerResourceTemplate, []inventory.ServerPrompt) { |
| 335 | if !hasStaticConfig(cfg) { |
| 336 | return github.AllTools(t), github.AllResources(t), github.AllPrompts(t) |
| 337 | } |
| 338 | |
| 339 | b := github.NewInventory(t). |
| 340 | WithReadOnly(cfg.ReadOnly). |
| 341 | WithToolsets(github.ResolvedEnabledToolsets(cfg.EnabledToolsets, cfg.EnabledTools)) |
| 342 | |
| 343 | if len(cfg.EnabledTools) > 0 { |
| 344 | b = b.WithTools(github.CleanTools(cfg.EnabledTools)) |
| 345 | } |
| 346 | |
| 347 | if len(cfg.ExcludeTools) > 0 { |
| 348 | b = b.WithExcludeTools(cfg.ExcludeTools) |
| 349 | } |
| 350 | |
| 351 | inv, err := b.Build() |
| 352 | if err != nil { |
| 353 | // Fall back to all tools if there's an error (e.g. unknown tool names). |
| 354 | // The error will surface again at per-request time if relevant. |
| 355 | return github.AllTools(t), github.AllResources(t), github.AllPrompts(t) |
| 356 | } |
| 357 | |
| 358 | ctx := context.Background() |
| 359 | return inv.AvailableTools(ctx), inv.AvailableResourceTemplates(ctx), inv.AvailablePrompts(ctx) |
| 360 | } |
| 361 | |
| 362 | // InventoryFiltersForRequest applies filters to the inventory builder |
| 363 | // based on the request context and headers. |
no test coverage detected