Skip to content

Commit 97d6d20

Browse files
lint: address revive (context-as-argument) and unused checkFeatureFlag
- Reorder captureRegisteredTools params to put context.Context first - Remove dead Builder.checkFeatureFlag (was only called by Build's former MCP Apps strip, now done in RegisterTools via the Inventory receiver's checkFeatureFlag instead) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent db41ab4 commit 97d6d20

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

pkg/inventory/builder.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,6 @@ func cleanTools(tools []string) []string {
190190
return cleaned
191191
}
192192

193-
// checkFeatureFlag checks a feature flag at build time using the builder's feature checker.
194-
// Returns false if no checker is configured or the flag is not enabled.
195-
func (b *Builder) checkFeatureFlag(flag string) bool {
196-
if b.featureChecker == nil {
197-
return false
198-
}
199-
enabled, err := b.featureChecker(context.Background(), flag)
200-
if err != nil {
201-
return false
202-
}
203-
return enabled
204-
}
205-
206193
// Build creates the final Inventory with all configuration applied.
207194
// This processes toolset filtering, tool name resolution, and sets up
208195
// the inventory for use. The returned Inventory is ready for use with

pkg/inventory/registry_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ func TestWithMCPApps_DisabledStripsUIMetadata(t *testing.T) {
18651865

18661866
// Default: MCP Apps is disabled - UI meta should be stripped on registration.
18671867
reg := mustBuild(t, NewBuilder().SetTools([]ServerTool{toolWithUI}).WithToolsets([]string{"all"}))
1868-
registered := captureRegisteredTools(t, reg, context.Background())
1868+
registered := captureRegisteredTools(context.Background(), t, reg)
18691869

18701870
require.Len(t, registered, 1)
18711871
if registered[0].Meta["ui"] != nil {
@@ -1952,7 +1952,7 @@ func TestWithMCPApps_UIOnlyMetaBecomesNil(t *testing.T) {
19521952
reg := mustBuild(t, NewBuilder().
19531953
SetTools([]ServerTool{toolUIOnly}).
19541954
WithToolsets([]string{"all"}))
1955-
registered := captureRegisteredTools(t, reg, context.Background())
1955+
registered := captureRegisteredTools(context.Background(), t, reg)
19561956

19571957
require.Len(t, registered, 1)
19581958
if registered[0].Meta != nil {
@@ -2239,7 +2239,7 @@ func TestCreateExcludeToolsFilter(t *testing.T) {
22392239
// captureRegisteredTools mirrors RegisterTools' per-request strip behavior so
22402240
// tests can verify what the wire sees, without requiring tools to have real
22412241
// handlers (RegisterTools panics on tools without HandlerFunc).
2242-
func captureRegisteredTools(t *testing.T, reg *Inventory, ctx context.Context) []*mcp.Tool {
2242+
func captureRegisteredTools(ctx context.Context, t *testing.T, reg *Inventory) []*mcp.Tool {
22432243
t.Helper()
22442244
tools := reg.AvailableTools(ctx)
22452245
out := make([]*mcp.Tool, 0, len(tools))

0 commit comments

Comments
 (0)