Repository navigation
MCP: add stats and today tools for surface parity - #31
Merged
Merged
Conversation
Exposes journal stats and today over MCP so a connected agent can get metrics and today's dashboard without shelling the CLI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Retro: no durable lesson (merged clean / one-off). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Agent-Generated PR
Closes #18
Agent Used: Claude Code
Complexity: low
Summary
Adds
statsandtodayMCP tools tojournal mcp, returning the same stable JSON shape asjournal stats --json/journal today --json. Rounds out the agent surface for "how's my note volume" and "what does my day look like" queries.Implementation Notes
mcp.AddTool+toolHandlerpattern used by all other tools.statsInput,todayMCPInput) consistent with how the SDK resolves typed handlers with no parameters.mcpStatsdelegates togatherStats(ctx, cfg, now())and marshals theStatsReport.mcpTodaydelegates togatherToday(ctx, cfg)(discarding the raw markdown string; the MCP consumer gets the structuredtodayReportJSON).cmd/stats.goandcmd/show.go.Changes
cmd/mcp.go: registerstatsandtodaytools; addmcpStatsandmcpTodayhandlers; addstatsInputandtodayMCPInputinput types.cmd/mcp_test.go:TestMCPStatsReturnsJSONandTestMCPTodayReturnsJSONcovering JSON shape and key fields.Testing
Automated:
Manual testing performed:
go test -p 1 -run "TestMCPStats|TestMCPToday" ./cmd/ -v— both pass.make test— all packages green.make buildandmake vet— clean.Review Checklist
Correctness
Code Quality
Security
Performance
Tests
Reviewer Notes
todayMCPInputis named to avoid collision withtodayReportandtodayJSONinshow.go. All other tool registrations use a descriptiveInputsuffix on their struct names.