Adds four new MCP tools for saving and retrieving agent chat histories.
New tools
Tool
Description
save_chat_history
Save a session's messages with optional title, summary, channel, agent, project
get_chat_history
Retrieve by UUID or session_id
list_chat_histories
List with filters: project, channel, agent_id, session_id, days
delete_chat_history
Hard-delete by UUID
Changes
migrations/018_chat_histories.sql — new chat_histories table with indexes on session_id, project_id, channel, agent_id, created_at, and FTS over title+summary
internal/types/extensions.go — ChatMessage and ChatHistory types
Adds save/get/list/delete tools for persisting and retrieving agent
chat histories in AMCS.
Changes:
- migrations/018_chat_histories.sql: new chat_histories table with
indexes on session_id, project_id, channel, agent_id, created_at,
and FTS over title+summary
- internal/types/extensions.go: ChatMessage and ChatHistory types
- internal/store/chat_histories.go: SaveChatHistory, GetChatHistory,
GetChatHistoryBySessionID, ListChatHistories, DeleteChatHistory
- internal/tools/chat_history.go: ChatHistoryTool with four handlers
(save_chat_history, get_chat_history, list_chat_histories,
delete_chat_history)
- internal/mcpserver/server.go: ChatHistory field in ToolSet,
registerChatHistoryTools registration function
- internal/app/app.go: wire ChatHistoryTool into ToolSet
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.