Repository navigation
feat(search): list_my_activity across connected sources for Search MCP and the Assistant #10535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+3,014
−115
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
581f52f
feat(search): list_my_activity across connected sources for Search MC…
waleedlatif1 f376c29
refactor(search): share live candidate helpers and provider date clau…
waleedlatif1 fa9053f
chore(search): tighten activity test assertions and comments
waleedlatif1 5197f3a
fix(search): keep activity paging lossless across failures, busy days…
waleedlatif1 33d6406
fix(search): keep paging after a recovered source, name disconnected …
waleedlatif1 23c7559
fix(search): start each activity account's deadline when it gets a slot
waleedlatif1 a66c75e
docs(search): document the activity input and flag check
waleedlatif1 84a705d
feat(search): admit workflow runs on the activity listing's organizat…
waleedlatif1 e32c843
fix(search): key activity entries by site and bound Gmail and Slack t…
waleedlatif1 137e058
fix(search): trim Calendar activity to the page and document the shar…
waleedlatif1 a521cff
fix(search): never count Calendar meetings at the resume bound toward…
waleedlatif1 1be33b6
chore(search): regenerate Mothership tool contracts after rebasing on…
waleedlatif1 97e292a
fix(search): give each activity entry its own citation and list the t…
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' | ||
| import type { Principal } from '@sim/auth/principal' | ||
| import type { NextRequest } from 'next/server' | ||
| import { listMyActivityMcpSchema } from '@/lib/api/contracts/knowledge/mcp' | ||
| import { knowledgeOperations } from '@/lib/knowledge/application/operations' | ||
| import { | ||
| KNOWLEDGE_MCP_READ_ONLY, | ||
| type KnowledgeMcpToolRunner, | ||
| projectResult, | ||
| } from '@/lib/knowledge/mcp/tool-runner' | ||
| import { listMyActivity } from '@/lib/sim-search/live/activity' | ||
|
|
||
| interface ListMyActivityToolContext { | ||
| execute: KnowledgeMcpToolRunner | ||
| principal: Principal | ||
| organizationId: string | ||
| request: NextRequest | ||
| } | ||
|
|
||
| /** | ||
| * Provider reads one call makes, for the rate limit: about one listing per connected source, | ||
| * which is more than a single search's share. | ||
| */ | ||
| const LIST_MY_ACTIVITY_COST = 2 | ||
|
|
||
| /** | ||
| * Registers `list_my_activity`: what the caller did across their connected sources in a window, | ||
| * newest first, with a status per source that names the ones to connect. | ||
| */ | ||
| export function registerListMyActivityTool( | ||
| server: McpServer, | ||
| { execute, principal, organizationId, request }: ListMyActivityToolContext | ||
| ) { | ||
| server.registerTool( | ||
| 'list_my_activity', | ||
| { | ||
| title: 'List my activity', | ||
| description: | ||
| 'List what you did across your connected sources in a date window, newest first: Slack messages and Gmail mail you sent or replied to, Google Calendar meetings you attended, Jira issues you created or are assigned, and Confluence pages you created or edited and comments you wrote. Use it for standups, weekly reports and open action items. Defaults to the last 7 days; the window spans at most 92 days. Each item has a documentId for read_document and its url to cite. approximateTime marks a time that is the item’s last update rather than your own action. When truncated is true, call again with nextCursor and the same arguments: pages continue without gaps. sources reports every source: not_connected and reconnect carry connect.url, where you connect that account.', | ||
| inputSchema: listMyActivityMcpSchema, | ||
| annotations: KNOWLEDGE_MCP_READ_ONLY, | ||
| }, | ||
| async (input: unknown, extra: { signal: AbortSignal }) => | ||
| execute( | ||
| 'list_my_activity', | ||
| knowledgeOperations.listActivity, | ||
| extra.signal, | ||
| async (registry, signal) => { | ||
| const parsed = listMyActivityMcpSchema.parse(input) | ||
| const result = await listMyActivity.execute({ | ||
| principal, | ||
| input: { ...parsed, organizationId, resultSecretRegistry: registry, signal }, | ||
| request, | ||
| }) | ||
| return projectResult(result, registry) | ||
| }, | ||
| LIST_MY_ACTIVITY_COST | ||
| ) | ||
| ) | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.