-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Bug Description
In pkg/inventory/instructions.go, the generateInstructions() function iterates over inv.AvailableToolsets() which returns all toolsets that have tools defined, rather than only the enabled toolsets based on the WithToolsets() configuration.
// Collect instructions from each enabled toolset
for _, toolset := range inv.AvailableToolsets() { // <- BUG: should use enabled toolsets
if toolset.InstructionsFunc != nil {
if toolsetInstructions := toolset.InstructionsFunc(inv); toolsetInstructions != "" {
instructions = append(instructions, toolsetInstructions)
}
}
}Expected Behavior
When building an inventory with WithToolsets([]string{"repos"}), the generated instructions should only include instructions for the repos toolset.
Actual Behavior
Instructions for all toolsets (context, issues, pull_requests, discussions, projects, etc.) are included regardless of which toolsets are enabled.
Evidence
From mcp-server-diff action comparing v0.29.0 (base) vs v0.30.1 (branch) with repos toolset only:
- Base (v0.29.0): 1226 chars of instructions
- Branch (v0.30.1): 5886 chars of instructions
The v0.30.1 instructions incorrectly include:
- "Always call 'get_me' first..." (context toolset - not enabled)
- Discussions instructions (not enabled)
- Issues instructions (not enabled)
- Projects instructions (not enabled)
How to Reproduce
- Update the mcp-server-diff action to v2.2.0 to see server instruction diffs in CI
- Build an inventory with a single toolset:
WithToolsets([]string{"repos"}).WithServerInstructions() - Check
inv.Instructions()- it will contain instructions for all toolsets, not just repos
Suggested Fix
Use EnabledToolsetIDs() and look up toolset metadata, or add a new EnabledToolsets() method that returns []ToolsetMetadata for only enabled toolsets:
for _, toolsetID := range inv.EnabledToolsetIDs() {
toolset := inv.GetToolsetMetadata(toolsetID) // or similar
if toolset.InstructionsFunc != nil {
// ...
}
}Version
v0.30.1