Skip to content

Generate server instructions in Inventory - #1869

Merged
tommaso-moro merged 5 commits into
mainfrom
tommy/inventory-instructions
Jan 23, 2026
Merged

tommaso-moro merged 5 commits into
mainfrom
tommy/inventory-instructions

Conversation

@tommaso-moro

@tommaso-moro tommaso-moro commented Jan 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR moves server instructions generation from NewMCPServer into the Inventory pattern, so instructions are computed at inventory build time rather than server creation time.

Note: This carries over changes from #1863 (which targets http-stack-2) to main, excluding the HTTP handler change which depends on the HTTP stack.

Changes

  • Added instructions field to Inventory struct with Instructions() getter method
  • Added InstructionsFunc field to ToolsetMetadata allowing each toolset to define its own instructions
  • Added WithServerInstructions() builder method that enables instruction generation during Build()
  • Created pkg/github/toolset_instructions.go with instruction functions for each toolset (context, issues, pull_requests, discussions, projects)
  • Moved instruction generation to pkg/inventory/instructions.go , which first adds base instructions and then iterates over toolsets and calls their InstructionsFunc
  • Updated STDIO path to use .WithServerInstructions() when building inventory
  • Updated NewMCPServer to use inventory.Instructions() instead of generating instructions inline

Testing

  • Unit tests moved to pkg/inventory/instructions_test.go
  • Manually verified STDIO server with/without .WithServerInstructions()

Demo

Screen.Recording.2026-01-22.at.17.24.48.mov

Why

This aligns with the architectural direction where the Inventory holds all pre-computed configuration, and the MCP server receives a fully-configured inventory rather than creating one itself. Instructions are generated based on the resolved enabled toolsets (after processing "default", "all" keywords, etc.)

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants