package tools import ( "context" "code.nochebuena.dev/einherjar/mcp/internal/index" "github.com/modelcontextprotocol/go-sdk/mcp" ) type getChangelogInput struct { Module string `json:"module" jsonschema:"the module name, e.g. core"` } type getChangelogOutput struct { Module string `json:"module"` Changelog string `json:"changelog"` } func registerGetChangelog(s *mcp.Server, idx *index.Index) { mcp.AddTool(s, &mcp.Tool{ Name: "get_changelog", Description: "Return the CHANGELOG.md markdown for one Einherjar module. Use to learn what changed in recent releases and to advise on upgrade-relevant differences.", }, func(ctx context.Context, req *mcp.CallToolRequest, args getChangelogInput) (*mcp.CallToolResult, getChangelogOutput, error) { m := idx.FindModule(args.Module) if m == nil { return errorResult("module not found: " + args.Module), getChangelogOutput{}, nil } out := getChangelogOutput{Module: m.Name, Changelog: m.Changelog} return jsonText(out), out, nil }) }