feat: add chat history MCP tools #1
Reference in New Issue
Block a user
Delete Branch "feature/chat-history"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds four new MCP tools for saving and retrieving agent chat histories.
New tools
save_chat_historyget_chat_historylist_chat_historiesdelete_chat_historyChanges
migrations/018_chat_histories.sql— newchat_historiestable with indexes on session_id, project_id, channel, agent_id, created_at, and FTS over title+summaryinternal/types/extensions.go—ChatMessageandChatHistorytypesinternal/store/chat_histories.go— store layerinternal/tools/chat_history.go— MCP tool handlersinternal/mcpserver/server.go— tool registrationinternal/app/app.go— wiringUsage example
There are a few changes you need to do. Make sure to look at migrations/100_rls_and_grants.sql and add the permission for new tables there
@@ -0,0 +23,4 @@CREATE INDEX IF NOT EXISTS idx_chat_histories_ftsON chat_historiesUSING GIN (to_tsvector('simple', coalesce(title, '') || ' ' || coalesce(summary, '')));You need to add
GRANT ALL ON TABLE public.chat_histories TO amcs;
Good catch — added
GRANT ALL ON TABLE public.chat_histories TO amcs;tomigrations/100_rls_and_grants.sqlin the latest commit.