Skip to content

Commit 7f9ecf1

Browse files
authored
feat(search): list your own chat history on Search MCP and in the Assistant (#10537)
* feat(search): list your own chat history on Search MCP and in the Assistant * improvement(search): chat history review pass — chats first, bounded answers, precise cursor * fix(search): type the chat history use case input * fix(search): match replies in transcript order and gate chat history on Search availability * fix(search): truncate chat history text at code points * fix(search): finish the code-point truncation change * fix(search): deleted questions still end their turn; clamp a future endDate to now * test(search): future-end assertion independent of other fixture rows * feat(search): admit workflow runs as their person on the chat history operation * fix(search): chat history lists only conversations the caller may still open
1 parent e34fbba commit 7f9ecf1

15 files changed

Lines changed: 993 additions & 4 deletions

File tree

‎apps/sim/lib/api/contracts/mothership-assistant-tools.ts‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,48 @@ export const searchPeopleInputSchema = z
371371
message: 'Pass either personId or a query with its cursor, not both.',
372372
})
373373

374+
/**
375+
* The caller's own questions to Sim over a window, oldest first. The 92-day window and the page
376+
* bounds are literals so the worker's generated copy stays standalone.
377+
*/
378+
export const listMyChatHistoryInputSchema = z
379+
.object({
380+
startDate: z
381+
.string()
382+
.datetime({ offset: true })
383+
.describe(
384+
'Inclusive lower bound on when you asked, as an ISO datetime with your timezone offset. For whole days, use local midnight on the first day.'
385+
),
386+
endDate: z
387+
.string()
388+
.datetime({ offset: true })
389+
.optional()
390+
.describe(
391+
'Exclusive upper bound, at most 92 days after startDate; defaults to now. For whole days, use local midnight after the final day.'
392+
),
393+
topK: z
394+
.number()
395+
.int()
396+
.min(1)
397+
.max(100)
398+
.optional()
399+
.describe('Questions per page, 50 by default.'),
400+
cursor: z
401+
.string()
402+
.min(1)
403+
.max(1024)
404+
.optional()
405+
.describe('nextCursor from the previous page of the same window.'),
406+
includeAnswers: z
407+
.boolean()
408+
.optional()
409+
.describe(
410+
"Adds the start of Sim's answer to each question. Answers reflect the sources as they were when asked."
411+
),
412+
})
413+
.strict()
414+
export type ListMyChatHistoryInput = z.output<typeof listMyChatHistoryInputSchema>
415+
374416
/** Connection requests name a provider and optionally an owned account to repair. */
375417
export const oauthGetAuthLinkInputSchema = z.object({
376418
providerName: z
@@ -441,6 +483,13 @@ export const assistantToolContracts = [
441483
'Look up people in this organization’s directory by name, email, title, department, or location. Returns each person’s title, department, location, email, and manager. When exactly one person matches, or with a personId, returns that person with managerChain (direct manager first) and directReports. Covers only this organization’s people; use search_workspace for customers, vendors, and other outside contacts.',
442484
inputSchema: searchPeopleInputSchema,
443485
},
486+
{
487+
id: 'list_my_chat_history',
488+
route: 'sim',
489+
description:
490+
'List the questions you asked Sim (the Assistant, agent chats, the Slack app and Search MCP chat) in a time window, oldest first, each with a link to its conversation. Covers only your own conversations that still exist.',
491+
inputSchema: listMyChatHistoryInputSchema,
492+
},
444493
{
445494
id: 'oauth_get_auth_link',
446495
route: 'sim',

0 commit comments

Comments
 (0)