Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix (ai): update search service client to match api return type (#772)

Eric Hayes698adca70d60
diff --git a/js/app/packages/app/component/dock/Dock.tsx b/js/app/packages/app/component/dock/Dock.tsx
index 0d7f17c699..830ddc3374 100644
--- a/js/app/packages/app/component/dock/Dock.tsx
+++ b/js/app/packages/app/component/dock/Dock.tsx
@@ -14,7 +14,7 @@ import { IconButton } from '@core/component/IconButton';
import IconQuestion from '@icon/regular/question.svg';
import { withAnalytics } from '@coparse/analytics';
import SplitIcon from '@macro-icons/new-split.svg';
-import IconAtom from '@macro-icons/macro-atom.svg';
+import IconAI from '@macro-icons/pixel/ai.svg';
import IconGear from '@macro-icons/macro-gear.svg';
import IconLogo from '@macro-icons/macro-logo.svg';
import { BasicTierLimit } from './BasicTierLimit';
@@ -306,7 +306,7 @@ export function Dock() {
hotkeyToken: TOKENS.split.go.toggleRightPanel,
label: 'Toggle AI Panel',
}}
- icon={IconAtom}
+ icon={IconAI}
size="sm"
/>
diff --git a/js/app/packages/core/component/AI/component/tool/UnifiedSearch.tsx b/js/app/packages/core/component/AI/component/tool/UnifiedSearch.tsx
index 76ff049614..14a9bd669d 100644
--- a/js/app/packages/core/component/AI/component/tool/UnifiedSearch.tsx
+++ b/js/app/packages/core/component/AI/component/tool/UnifiedSearch.tsx
@@ -41,7 +41,7 @@ const UnifiedSearchToolResponse = (props: {
key = result.channel_id;
break;
case 'project':
- key = result.project_id;
+ key = result.id;
break;
default:
return false;
@@ -57,13 +57,13 @@ const UnifiedSearchToolResponse = (props: {
case 'document':
return result.document_name || 'Document';
case 'chat':
- return result.title || 'Chat';
+ return result.name || 'Chat';
case 'email':
return result.subject || 'Email';
case 'channel':
return 'Channel'; // there are no channel names from search results
case 'project':
- return result.project_name || 'Project';
+ return result.name || 'Project';
default:
return 'Result';
}
@@ -92,7 +92,7 @@ const UnifiedSearchToolResponse = (props: {
};
case 'project':
return () => {
- replaceOrInsertSplit({ type: 'project', id: result.project_id });
+ replaceOrInsertSplit({ type: 'project', id: result.id });
};
default:
return undefined;
diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts b/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
index 89e470593f..d28fd9ea61 100644
--- a/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
@@ -68,7 +68,7 @@ export const UnifiedSearch = z.object({ "exhaustiveSearch": z.boolean().default(
export const UnifiedSearchResponseOutput = z.object({ "response": z.object({ "results": z.array(z.any().superRefine((x, ctx) => {
- const schemas = [z.object({ "document_id": z.string(), "document_name": z.string(), "file_type": z.string(), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "node_id": z.string(), "owner_id": z.string(), "raw_content": z.union([z.string(), z.null()]).optional(), "type": z.literal("document"), "updated_at": z.string().datetime({ offset: true }) }), z.object({ "chat_id": z.string(), "chat_message_id": z.string(), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "role": z.string(), "title": z.string(), "type": z.literal("chat"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() }), z.object({ "bcc": z.array(z.string()), "cc": z.array(z.string()), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "labels": z.array(z.string()), "link_id": z.string(), "message_id": z.string(), "recipients": z.array(z.string()), "sender": z.string(), "sent_at": z.union([z.string().datetime({ offset: true }), z.null()]).optional(), "subject": z.union([z.string(), z.null()]).optional(), "thread_id": z.string(), "type": z.literal("email"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() }), z.object({ "channel_id": z.string(), "channel_type": z.string(), "created_at": z.string().datetime({ offset: true }), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "mentions": z.array(z.string()), "message_id": z.string(), "org_id": z.union([z.number().int(), z.null()]).optional(), "sender_id": z.string(), "thread_id": z.union([z.string(), z.null()]).optional(), "type": z.literal("channel"), "updated_at": z.string().datetime({ offset: true }) }), z.object({ "created_at": z.string().datetime({ offset: true }), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "project_id": z.string(), "project_name": z.string(), "type": z.literal("project"), "updated_at": z.string().datetime({ offset: true }), "user_id": z.string() })];
+ const schemas = [z.object({ "document_id": z.string().uuid(), "document_name": z.string(), "document_search_results": z.array(z.object({ "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "node_id": z.union([z.string(), z.null()]).optional(), "raw_content": z.union([z.string(), z.null()]).optional(), "score": z.union([z.number(), z.null()]).optional() })), "file_type": z.union([z.string(), z.null()]).optional(), "id": z.string().uuid(), "metadata": z.union([z.object({ "created_at": z.number().int(), "deleted_at": z.union([z.number().int(), z.null()]).optional(), "project_id": z.union([z.string(), z.null()]).optional(), "updated_at": z.number().int(), "viewed_at": z.union([z.number().int(), z.null()]).optional() }), z.null()]).optional(), "name": z.string(), "owner_id": z.string(), "sub_type": z.union([z.literal("task"), z.null()]).optional(), "type": z.literal("document") }), z.object({ "chat_id": z.string().uuid(), "chat_search_results": z.array(z.object({ "chat_message_id": z.union([z.string().uuid(), z.null()]).optional(), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "role": z.union([z.string(), z.null()]).optional(), "score": z.union([z.number(), z.null()]).optional() })), "id": z.string().uuid(), "metadata": z.union([z.object({ "created_at": z.number().int(), "deleted_at": z.union([z.number().int(), z.null()]).optional(), "project_id": z.union([z.string(), z.null()]).optional(), "updated_at": z.number().int(), "viewed_at": z.union([z.number().int(), z.null()]).optional() }), z.null()]).optional(), "name": z.string(), "owner_id": z.string(), "type": z.literal("chat"), "user_id": z.string() }), z.object({ "created_at": z.number().int(), "email_message_search_results": z.array(z.object({ "bcc": z.array(z.string()), "cc": z.array(z.string()), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "labels": z.array(z.string()), "message_id": z.union([z.string().uuid(), z.null()]).optional(), "pretty_sender": z.string(), "recipients": z.array(z.string()), "score": z.union([z.number(), z.null()]).optional(), "sender": z.string(), "sent_at": z.union([z.number().int(), z.null()]).optional() })), "id": z.string().uuid(), "name": z.union([z.string(), z.null()]).optional(), "owner_id": z.string(), "snippet": z.union([z.string(), z.null()]).optional(), "subject": z.union([z.string(), z.null()]).optional(), "thread_id": z.string().uuid(), "type": z.literal("email"), "updated_at": z.number().int(), "user_id": z.string(), "viewed_at": z.union([z.number().int(), z.null()]).optional() }), z.object({ "channel_id": z.string().uuid(), "channel_message_search_results": z.array(z.object({ "created_at": z.union([z.number().int(), z.null()]).optional(), "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "message_id": z.union([z.string().uuid(), z.null()]).optional(), "score": z.union([z.number(), z.null()]).optional(), "sender_id": z.union([z.string(), z.null()]).optional(), "thread_id": z.union([z.string().uuid(), z.null()]).optional(), "updated_at": z.union([z.number().int(), z.null()]).optional() })), "channel_type": z.string(), "id": z.string().uuid(), "metadata": z.union([z.object({ "created_at": z.number().int(), "interacted_at": z.union([z.number().int(), z.null()]).optional(), "updated_at": z.number().int(), "viewed_at": z.union([z.number().int(), z.null()]).optional() }), z.null()]).optional(), "owner_id": z.union([z.string(), z.null()]).optional(), "type": z.literal("channel") }), z.object({ "created_at": z.number().int(), "id": z.string().uuid(), "metadata": z.union([z.object({ "created_at": z.number().int(), "deleted_at": z.union([z.number().int(), z.null()]).optional(), "parent_project_id": z.union([z.string(), z.null()]).optional(), "updated_at": z.number().int(), "viewed_at": z.union([z.number().int(), z.null()]).optional() }), z.null()]).optional(), "name": z.string(), "owner_id": z.string(), "project_search_results": z.array(z.object({ "highlight": z.object({ "bcc": z.array(z.string()).optional(), "cc": z.array(z.string()).optional(), "content": z.array(z.string()).optional(), "name": z.union([z.string(), z.null()]).optional(), "recipients": z.array(z.string()).optional(), "sender": z.union([z.string(), z.null()]).optional(), "user_id": z.union([z.string(), z.null()]).optional() }), "score": z.union([z.number(), z.null()]).optional() })), "type": z.literal("project"), "updated_at": z.number().int() })];
const errors = schemas.reduce<z.ZodError[]>(
(errors, schema) =>
((result) =>
diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/types.ts b/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
index 772534b544..29fcddaf8c 100644
--- a/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
@@ -541,339 +541,443 @@ export interface UnifiedSearchResponseOutput {
results: (
| {
/**
- * The document id
+ * The id of the document
*/
document_id: string;
/**
- * The document name
+ * The name of the document
*/
document_name: string;
/**
- * The file type
+ * The search results for the document
+ * This may be empty if the search result match was on the document name only
*/
- file_type: string;
- /**
- * The highlights on the document
- */
- highlight: {
- /**
- * The highlight match on the bcc (email only)
- */
- bcc?: string[];
- /**
- * The highlight match on the cc (email only)
- */
- cc?: string[];
+ document_search_results: {
/**
- * The highlight match on the content field
+ * The highlights for the document
*/
- content?: string[];
+ highlight: {
+ /**
+ * The highlight match on the bcc (email only)
+ */
+ bcc?: string[];
+ /**
+ * The highlight match on the cc (email only)
+ */
+ cc?: string[];
+ /**
+ * The highlight match on the content field
+ */
+ content?: string[];
+ /**
+ * The highlight match on the name field
+ */
+ name?: string | null;
+ /**
+ * The highlight match on the recipients (email only)
+ */
+ recipients?: string[];
+ /**
+ * The highlight match on the sender (email only)
+ */
+ sender?: string | null;
+ /**
+ * The highlight match on the user (owner) of the entity
+ */
+ user_id?: string | null;
+ };
/**
- * The highlight match on the name field
+ * The node id for the document.
+ * This is only useful for markdown at the moment
+ * This will only be provided if the match was on content
*/
- name?: string | null;
+ node_id?: string | null;
/**
- * The highlight match on the recipients (email only)
+ * The raw content of the document.
+ * This is only included for markdown files and will be the raw json node of the match
*/
- recipients?: string[];
+ raw_content?: string | null;
/**
- * The highlight match on the sender (email only)
+ * The score of the result
*/
- sender?: string | null;
- /**
- * The highlight match on the user (owner) of the entity
- */
- user_id?: string | null;
- };
+ score?: number | null;
+ }[];
/**
- * The node id
+ * The file type of the document
*/
- node_id: string;
+ file_type?: string | null;
/**
- * The owner id
+ * Standardized fields that all item types will share.
+ * These field names are being aligned across all item types
+ * for consistency in our data model.
*/
- owner_id: string;
+ id: string;
/**
- * The raw content of the document
+ * Metadata from the database. None if the document doesn't exist in the database.
*/
- raw_content?: string | null;
- type: 'document';
+ metadata?: {
+ created_at: number;
+ deleted_at?: number | null;
+ project_id?: string | null;
+ updated_at: number;
+ viewed_at?: number | null;
+ } | null;
+ name: string;
+ owner_id: string;
/**
- * The time the document was last updated
+ * The sub type of the document if present.
*/
- updated_at: string;
+ sub_type?: 'task' | null;
+ type: 'document';
}
| {
/**
- * The chat id
+ * The id of the chat
*/
chat_id: string;
/**
- * The chat message id
- */
- chat_message_id: string;
- /**
- * The highlights on the chat
+ * The search results for the chat
+ * This may be empty if the search result match was on the chat title only
*/
- highlight: {
- /**
- * The highlight match on the bcc (email only)
- */
- bcc?: string[];
+ chat_search_results: {
/**
- * The highlight match on the cc (email only)
+ * The chat message id for the chat
+ * This is only present if the search match was on the chat message content
*/
- cc?: string[];
+ chat_message_id?: string | null;
/**
- * The highlight match on the content field
+ * The highlights for the chat message
*/
- content?: string[];
+ highlight: {
+ /**
+ * The highlight match on the bcc (email only)
+ */
+ bcc?: string[];
+ /**
+ * The highlight match on the cc (email only)
+ */
+ cc?: string[];
+ /**
+ * The highlight match on the content field
+ */
+ content?: string[];
+ /**
+ * The highlight match on the name field
+ */
+ name?: string | null;
+ /**
+ * The highlight match on the recipients (email only)
+ */
+ recipients?: string[];
+ /**
+ * The highlight match on the sender (email only)
+ */
+ sender?: string | null;
+ /**
+ * The highlight match on the user (owner) of the entity
+ */
+ user_id?: string | null;
+ };
/**
- * The highlight match on the name field
+ * The role of the chat message
+ * This is only present if the search match was on the chat message content
*/
- name?: string | null;
+ role?: string | null;
/**
- * The highlight match on the recipients (email only)
+ * The score of the result
*/
- recipients?: string[];
- /**
- * The highlight match on the sender (email only)
- */
- sender?: string | null;
- /**
- * The highlight match on the user (owner) of the entity
- */
- user_id?: string | null;
- };
+ score?: number | null;
+ }[];
/**
- * The role
+ * Standardized fields that all item types will share.
+ * These field names are being aligned across all item types
+ * for consistency in our data model.
*/
- role: string;
+ id: string;
/**
- * The title
+ * Metadata from the database. None if the chat doesn't exist in the database.
*/
- title: string;
+ metadata?: {
+ created_at: number;
+ deleted_at?: number | null;
+ project_id?: string | null;
+ updated_at: number;
+ viewed_at?: number | null;
+ } | null;
+ name: string;
+ owner_id: string;
type: 'chat';
/**
- * The time the chat was last updated
- */
- updated_at: string;
- /**
- * The user id
+ * The id of the creator of the chat
*/
user_id: string;
}
| {
+ created_at: number;
/**
- * The bcc
- */
- bcc: string[];
- /**
- * The cc
- */
- cc: string[];
- /**
- * The highlights on the email
+ * The search results for the document
+ * This may be empty if the search result match was on the email subject only
*/
- highlight: {
+ email_message_search_results: {
/**
- * The highlight match on the bcc (email only)
+ * This is only present if the search result is on the message content
*/
- bcc?: string[];
+ bcc: string[];
/**
- * The highlight match on the cc (email only)
+ * This is only present if the search result is on the message content
*/
- cc?: string[];
+ cc: string[];
/**
- * The highlight match on the content field
+ * The highlights for the email message
*/
- content?: string[];
+ highlight: {
+ /**
+ * The highlight match on the bcc (email only)
+ */
+ bcc?: string[];
+ /**
+ * The highlight match on the cc (email only)
+ */
+ cc?: string[];
+ /**
+ * The highlight match on the content field
+ */
+ content?: string[];
+ /**
+ * The highlight match on the name field
+ */
+ name?: string | null;
+ /**
+ * The highlight match on the recipients (email only)
+ */
+ recipients?: string[];
+ /**
+ * The highlight match on the sender (email only)
+ */
+ sender?: string | null;
+ /**
+ * The highlight match on the user (owner) of the entity
+ */
+ user_id?: string | null;
+ };
/**
- * The highlight match on the name field
+ * This is only present if the search result is on the message content
*/
- name?: string | null;
+ labels: string[];
/**
- * The highlight match on the recipients (email only)
+ * The email message id.
+ * This is only present if the search result is on the message content
*/
- recipients?: string[];
+ message_id?: string | null;
/**
- * The highlight match on the sender (email only)
+ * The pretty sender.
+ * If the match is on the subject, the pretty sender is the latest sender on the thread.
+ * This could be the sender's email if there is no contact name for the sender.
*/
- sender?: string | null;
+ pretty_sender: string;
/**
- * The highlight match on the user (owner) of the entity
+ * This is only present if the search result is on the message content
*/
- user_id?: string | null;
- };
- /**
- * The labels
- */
- labels: string[];
- /**
- * The link id
- */
- link_id: string;
- /**
- * The message id
- */
- message_id: string;
- /**
- * The recipients
- */
- recipients: string[];
+ recipients: string[];
+ /**
+ * The score of the result
+ */
+ score?: number | null;
+ /**
+ * The sender.
+ * If the match is on the subject, the sender is the latest sender on the thread.
+ */
+ sender: string;
+ /**
+ * When the email message was sent
+ * This is only present if the search result is on the message content
+ */
+ sent_at?: number | null;
+ }[];
/**
- * The sender
+ * Standardized fields that all item types will share.
+ * These field names are being aligned across all item types
+ * for consistency in our data model.
*/
- sender: string;
+ id: string;
/**
- * The time the email was sent
+ * Subject of the email thread
*/
- sent_at?: string | null;
+ name?: string | null;
+ owner_id: string;
+ snippet?: string | null;
/**
- * The subject
+ * The subject of the email
+ * This is only present if the search result is on the message content
*/
subject?: string | null;
/**
- * The thread id
+ * The id of the email thread
*/
thread_id: string;
type: 'email';
+ updated_at: number;
/**
- * The time the email was last updated
- */
- updated_at: string;
- /**
- * The user id
+ * The id of the owner of the email thread
*/
user_id: string;
+ viewed_at?: number | null;
}
| {
/**
- * The channel id
+ * The id of the channel
*/
channel_id: string;
/**
- * The channel type
- */
- channel_type: string;
- /**
- * The time the channel message was created
+ * The search results for the channel
+ * This may be empty if the search result match was not on content
*/
- created_at: string;
- /**
- * The highlights on the channel message
- */
- highlight: {
+ channel_message_search_results: {
/**
- * The highlight match on the bcc (email only)
+ * When the channel message was created
+ * This is only prsent if the search result is on the message content
*/
- bcc?: string[];
+ created_at?: number | null;
/**
- * The highlight match on the cc (email only)
+ * The highlights for the channel message
*/
- cc?: string[];
+ highlight: {
+ /**
+ * The highlight match on the bcc (email only)
+ */
+ bcc?: string[];
+ /**
+ * The highlight match on the cc (email only)
+ */
+ cc?: string[];
+ /**
+ * The highlight match on the content field
+ */
+ content?: string[];
+ /**
+ * The highlight match on the name field
+ */
+ name?: string | null;
+ /**
+ * The highlight match on the recipients (email only)
+ */
+ recipients?: string[];
+ /**
+ * The highlight match on the sender (email only)
+ */
+ sender?: string | null;
+ /**
+ * The highlight match on the user (owner) of the entity
+ */
+ user_id?: string | null;
+ };
/**
- * The highlight match on the content field
+ * The channel message id
+ * This is only prsent if the search result is on the message content
*/
- content?: string[];
+ message_id?: string | null;
/**
- * The highlight match on the name field
+ * The score of the result
*/
- name?: string | null;
+ score?: number | null;
/**
- * The highlight match on the recipients (email only)
+ * The sender id
+ * This is only prsent if the search result is on the message content
*/
- recipients?: string[];
+ sender_id?: string | null;
/**
- * The highlight match on the sender (email only)
+ * The channel message thread id
*/
- sender?: string | null;
+ thread_id?: string | null;
/**
- * The highlight match on the user (owner) of the entity
+ * When the channel message was last updated
+ * This is only prsent if the search result is on the message content
*/
- user_id?: string | null;
- };
- /**
- * The mentions
- */
- mentions: string[];
+ updated_at?: number | null;
+ }[];
/**
- * The message id
+ * The type of channel
*/
- message_id: string;
+ channel_type: string;
/**
- * The org id
+ * Standardized fields that all item types will share.
+ * These field names are being aligned across all item types
+ * for consistency in our data model.
*/
- org_id?: number | null;
+ id: string;
/**
- * The sender id
+ * Metadata from the database. None if the channel doesn't exist in the database.
*/
- sender_id: string;
+ metadata?: {
+ created_at: number;
+ interacted_at?: number | null;
+ updated_at: number;
+ viewed_at?: number | null;
+ } | null;
/**
- * The thread id
+ * we don't store this for channels atm but keeping it here for consistency
*/
- thread_id?: string | null;
+ owner_id?: string | null;
type: 'channel';
- /**
- * The time the channel message was last updated
- */
- updated_at: string;
}
| {
+ created_at: number;
/**
- * The time the project was created
+ * Standardized fields that all item types will share.
+ * These field names are being aligned across all item types
+ * for consistency in our data model.
*/
- created_at: string;
+ id: string;
/**
- * The highlights on the project
+ * Metadata from the database. None if the project doesn't exist in the database.
*/
- highlight: {
- /**
- * The highlight match on the bcc (email only)
- */
- bcc?: string[];
- /**
- * The highlight match on the cc (email only)
- */
- cc?: string[];
- /**
- * The highlight match on the content field
- */
- content?: string[];
- /**
- * The highlight match on the name field
- */
- name?: string | null;
- /**
- * The highlight match on the recipients (email only)
- */
- recipients?: string[];
- /**
- * The highlight match on the sender (email only)
- */
- sender?: string | null;
+ metadata?: {
+ created_at: number;
+ deleted_at?: number | null;
+ parent_project_id?: string | null;
+ updated_at: number;
+ viewed_at?: number | null;
+ } | null;
+ name: string;
+ owner_id: string;
+ project_search_results: {
+ highlight: {
+ /**
+ * The highlight match on the bcc (email only)
+ */
+ bcc?: string[];
+ /**
+ * The highlight match on the cc (email only)
+ */
+ cc?: string[];
+ /**
+ * The highlight match on the content field
+ */
+ content?: string[];
+ /**
+ * The highlight match on the name field
+ */
+ name?: string | null;
+ /**
+ * The highlight match on the recipients (email only)
+ */
+ recipients?: string[];
+ /**
+ * The highlight match on the sender (email only)
+ */
+ sender?: string | null;
+ /**
+ * The highlight match on the user (owner) of the entity
+ */
+ user_id?: string | null;
+ };
/**
- * The highlight match on the user (owner) of the entity
+ * The score of the result
*/
- user_id?: string | null;
- };
- /**
- * The project id
- */
- project_id: string;
- /**
- * The project name
- */
- project_name: string;
+ score?: number | null;
+ }[];
type: 'project';
- /**
- * The time the project was last updated
- */
- updated_at: string;
- /**
- * The id of the user who created the project
- */
- user_id: string;
+ updated_at: number;
}
)[];
/**
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index e17c57de91..444adffed7 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -2725,6 +2725,7 @@ dependencies = [
name = "document_sub_type"
version = "0.1.0"
dependencies = [
+ "schemars",
"serde",
"sqlx",
"strum",
diff --git a/rust/cloud-storage/ai_tools/src/search/unified.rs b/rust/cloud-storage/ai_tools/src/search/unified.rs
index 73e7ba0508..a91dd848a4 100644
--- a/rust/cloud-storage/ai_tools/src/search/unified.rs
+++ b/rust/cloud-storage/ai_tools/src/search/unified.rs
@@ -3,10 +3,7 @@ use std::cmp::min;
use crate::tool_context::{RequestContext, ToolServiceContext};
use ai::tool::{AsyncTool, ToolCallError, ToolResult};
use async_trait::async_trait;
-use models_search::{
- HumanReadableTimestamp,
- unified::{SimpleUnifiedSearchResponseBaseItem, UnifiedSearchRequest},
-};
+use models_search::unified::{UnifiedSearchRequest, UnifiedSearchResponseItem};
use schemars::{JsonSchema, Schema};
use serde::{Deserialize, Serialize};
@@ -34,7 +31,7 @@ fn default_page_size() -> i64 {
#[serde(rename_all = "camelCase")]
pub struct TruncatedUnifiedSearchResponse {
/// The search results (truncated to `results_returned` limit if applicable)
- pub results: Vec<SimpleUnifiedSearchResponseBaseItem<HumanReadableTimestamp>>,
+ pub results: Vec<UnifiedSearchResponseItem>,
/// total number of results from search
pub total_results: usize,
/// the number of results returned
@@ -92,7 +89,7 @@ async fn fetch_all_pages_simple(
context: &ToolServiceContext,
request_context: &RequestContext,
search_request: &UnifiedSearchRequest,
-) -> Result<Vec<SimpleUnifiedSearchResponseBaseItem<HumanReadableTimestamp>>, ToolCallError> {
+) -> Result<Vec<UnifiedSearchResponseItem>, ToolCallError> {
const BATCH_SIZE: usize = 4;
let mut page = 0;
let mut all_results = vec![];
@@ -121,7 +118,7 @@ async fn fetch_all_pages_simple(
let task = tokio::spawn(async move {
let result = context
.search_service_client
- .search_simple_unified(
+ .search_unified(
&request_context.user_id,
search_request,
current_page,
@@ -291,7 +288,7 @@ impl AsyncTool<ToolServiceContext, RequestContext> for UnifiedSearch {
match context
.search_service_client
- .search_simple_unified(&request_context.user_id, search_request, page, page_size)
+ .search_unified(&request_context.user_id, search_request, page, page_size)
.await
{
Ok(response) => {
diff --git a/rust/cloud-storage/document_cognition_service/schemas/tools.json b/rust/cloud-storage/document_cognition_service/schemas/tools.json
index 6005a5ff35..11479ef1f4 100644
--- a/rust/cloud-storage/document_cognition_service/schemas/tools.json
+++ b/rust/cloud-storage/document_cognition_service/schemas/tools.json
@@ -1,1916 +1,2259 @@
{
"schemas": [
{
- "name": "Read",
+ "name": "ListDocuments",
"inputSchema": {
"additionalProperties": false,
- "description": "Read content by ID(s). Supports reading documents, channels, chats, and emails by their respective IDs. Use this tool when you need to retrieve the full content of a specific item(s).\n Channel transcripts only include 300 messages. Use 'messages_since' to see messages in a different time window.",
+ "description": "List documents the user has access to with optional filtering and pagination. Only applies to documents, not emails, AI conversations, chat/slack threads, projects aka folders. This tool returns document metadata including access levels and supports filtering by file type, minimum access level, and pagination. Use this tool to discover and browse documents before using the Read tool to access their content. Prefer using the search tool to search on a specific matching string within the content or the name of the entity.",
"properties": {
- "contentType": {
+ "exhaustiveSearch": {
"additionalProperties": false,
- "description": "The type of content to read. Choose based on the type of content you want to retrieve.",
- "enum": [
- "document",
- "channel",
- "channel-message",
- "chat-thread",
- "chat-message",
- "email-thread",
- "email-message",
- "project"
- ],
- "type": "string"
+ "default": false,
+ "description": "Exhaustive search to get all results. Defaults to false. Set to true when you need all matching documents, ignoring pagination limits.",
+ "type": "boolean"
},
- "ids": {
+ "fileTypes": {
"additionalProperties": false,
- "description": "ID(s) of the content to read. IMPORTANT: document, channel-message, chat-message, and email-message content types support MULTIPLE ids! For all other content types (channel, chat-thread, email-thread) provide a single id.",
+ "description": "Document file types to include. Examples: ['pdf'], ['md', 'txt']. Leave empty to include all document types.",
"items": {
"additionalProperties": false,
"type": "string"
},
- "type": "array"
+ "type": [
+ "array",
+ "null"
+ ]
},
- "messagesSince": {
+ "minAccessLevel": {
"additionalProperties": false,
- "description": "A local datetime of the earliest message to include in a channel transcript ex: 2025-11-25 12:00:09 EST, only applicable to channels",
- "format": "date-time",
+ "description": "Minimum access level required. Defaults to 'view' if not specified.",
+ "enum": [
+ "view",
+ "comment",
+ "edit",
+ "owner",
+ null
+ ],
"type": [
"string",
"null"
]
+ },
+ "pageOffset": {
+ "additionalProperties": false,
+ "default": 0,
+ "description": "Page offset for pagination. Default is 0. Use higher values to get subsequent pages of results.",
+ "format": "int64",
+ "type": "integer"
+ },
+ "pageSize": {
+ "additionalProperties": false,
+ "default": 50,
+ "description": "Number of results per page. Max is 100, default is 50. Use smaller values for focused results.",
+ "format": "int64",
+ "type": "integer"
}
},
"required": [
- "contentType",
- "ids",
- "messagesSince"
+ "exhaustiveSearch",
+ "fileTypes",
+ "minAccessLevel",
+ "pageOffset",
+ "pageSize"
],
- "title": "Read",
+ "title": "ListDocuments",
"type": "object"
},
"outputSchema": {
"properties": {
- "content": {
- "oneOf": [
- {
- "properties": {
- "documents": {
- "items": {
- "properties": {
- "content": {
- "type": "string"
- },
- "documentId": {
- "type": "string"
- },
- "metadata": {
- "properties": {
- "deleted": {
- "type": "boolean"
- },
- "documentName": {
- "type": "string"
- },
- "fileType": {
- "type": [
- "string",
- "null"
- ]
- },
- "owner": {
- "type": "string"
- },
- "projectId": {
- "type": [
- "string",
- "null"
- ]
- }
- },
- "required": [
- "documentName",
- "owner",
- "deleted"
- ],
- "type": "object"
- }
- },
- "required": [
- "documentId",
- "content",
- "metadata"
- ],
- "type": "object"
- },
- "type": "array"
- },
- "type": {
- "const": "documents",
- "type": "string"
- }
+ "results": {
+ "description": "The list results (truncated to `results_returned` limit if applicable)",
+ "items": {
+ "properties": {
+ "access_level": {
+ "description": "The user's access level to this document",
+ "enum": [
+ "view",
+ "comment",
+ "edit",
+ "owner"
+ ],
+ "type": "string"
},
- "required": [
- "type",
- "documents"
- ],
- "type": "object"
- },
- {
- "properties": {
- "channel_id": {
- "type": "string"
- },
- "channel_name": {
- "type": [
- "string",
- "null"
- ]
- },
- "transcript": {
- "type": "string"
- },
- "type": {
- "const": "channel",
- "type": "string"
- }
+ "created_at": {
+ "description": "When the document was created",
+ "format": "date-time",
+ "type": "string"
},
- "required": [
- "type",
- "channel_id",
- "transcript"
- ],
- "type": "object"
+ "deleted_at": {
+ "description": "When the document was deleted (null if not deleted)",
+ "format": "date-time",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "document_id": {
+ "description": "The document id",
+ "type": "string"
+ },
+ "document_name": {
+ "description": "The document name",
+ "type": "string"
+ },
+ "file_type": {
+ "description": "The file type of the document",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "owner": {
+ "description": "The owner of the document",
+ "type": "string"
+ },
+ "project_id": {
+ "description": "The project id containing the document",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "updated_at": {
+ "description": "When the document was last updated",
+ "format": "date-time",
+ "type": "string"
+ }
},
- {
- "properties": {
- "conversation": {
- "items": {
- "properties": {
- "chat_id": {
- "type": "string"
- },
- "messages": {
- "items": {
- "properties": {
- "attachment_summaries": {
- "items": {
- "oneOf": [
- {
- "additionalProperties": false,
- "properties": {
- "Summary": {
- "properties": {
- "created_at": {
- "format": "date-time",
- "type": [
- "string",
- "null"
- ]
- },
- "document_id": {
- "type": "string"
- },
- "id": {
- "type": [
- "string",
- "null"
- ]
- },
- "summary": {
- "type": "string"
- },
- "version_id": {
- "type": "string"
- }
- },
- "required": [
- "document_id",
- "summary",
- "version_id"
- ],
- "type": "object"
- }
- },
- "required": [
- "Summary"
- ],
- "type": "object"
- },
- {
- "additionalProperties": false,
- "properties": {
- "NoSummary": {
- "properties": {
- "document_id": {
- "type": "string"
- }
- },
- "required": [
- "document_id"
- ],
- "type": "object"
- }
- },
- "required": [
- "NoSummary"
- ],
- "type": "object"
- }
- ]
- },
- "type": "array"
- },
- "content": {
- "type": "string"
- },
- "date": {
- "format": "date-time",
- "type": "string"
- }
- },
- "required": [
- "content",
- "date",
- "attachment_summaries"
- ],
- "type": "object"
- },
- "type": "array"
- },
- "title": {
- "type": "string"
- }
- },
- "required": [
- "chat_id",
- "title",
- "messages"
- ],
- "type": "object"
- },
- "type": "array"
- },
- "type": {
- "const": "chat",
- "type": "string"
- }
- },
- "required": [
- "type",
- "conversation"
- ],
- "type": "object"
- },
- {
- "properties": {
- "messages": {
- "items": {
- "properties": {
- "bcc": {
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "cc": {
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "content": {
- "type": "string"
- },
- "messageId": {
- "type": "string"
- },
- "recipients": {
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "sender": {
- "type": "string"
- },
- "sentAt": {
- "format": "date-time",
- "type": [
- "string",
- "null"
- ]
- }
- },
- "required": [
- "messageId",
- "sender",
- "recipients",
- "cc",
- "bcc",
- "content"
- ],
- "type": "object"
- },
- "type": "array"
- },
- "subject": {
- "type": [
- "string",
- "null"
- ]
- },
- "thread_id": {
- "type": "string"
- },
- "type": {
- "const": "email",
- "type": "string"
- }
- },
- "required": [
- "type",
- "thread_id",
- "messages"
- ],
- "type": "object"
- },
- {
- "properties": {
- "formatted_preview": {
- "type": "string"
- },
- "type": {
- "const": "itemPreviews",
- "type": "string"
- }
- },
- "required": [
- "type",
- "formatted_preview"
- ],
- "type": "object"
- }
- ]
+ "required": [
+ "document_id",
+ "document_name",
+ "owner",
+ "created_at",
+ "updated_at",
+ "access_level"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "resultsReturned": {
+ "description": "The number of results returned",
+ "format": "uint",
+ "minimum": 0,
+ "type": "integer"
+ },
+ "totalResults": {
+ "description": "Total number of results found",
+ "format": "uint",
+ "minimum": 0,
+ "type": "integer"
}
},
"required": [
- "content"
+ "results",
+ "totalResults",
+ "resultsReturned"
],
- "title": "ReadResponse",
+ "title": "ListDocumentsResponse",
"type": "object"
}
},
{
- "name": "UnifiedSearch",
+ "name": "ListEmails",
"inputSchema": {
"additionalProperties": false,
- "description": "Universal search across all content types (documents, emails, AI conversations, chat/slack threads/channels, projects aka folders). This tool will return broad metadata from successful results and/or content matches. Use the Read tool next to read the results from those matches. Only ever refer to documents by name or with a document mention. Never state the id of the document in plaintext. User's are presented with the results of this tool as a UI element so there is no need to enumerate the information found from this tool.",
+ "description": "List the emails the user has access to. Use this tool to discover and browse emails before using the Read tool to access their content. Prefer using the search tool to search on a specific matching string within the content or the name of the entity.",
"properties": {
- "exhaustiveSearch": {
+ "cursor": {
"additionalProperties": false,
- "default": true,
- "description": "Exhaustive search across all results matching the query. Defaults to true. Use false when the user only requires a limitied subset of results to answer the question",
- "type": "boolean"
+ "default": null,
+ "description": "A preview response will tell you what the next cursor id is.\n If expected emails are not in the current response and it gives you a cursor id, use this field to list the next page of emails. If no cursor id is provided you've reached the end",
+ "type": [
+ "string",
+ "null"
+ ]
},
- "pageOffset": {
+ "limit": {
"additionalProperties": false,
- "default": 0,
- "description": "Page offset. Default is 0. Use a higher offset to page through results intelligently. Set exhaustive_search to true to get all results.",
+ "default": 20,
+ "description": "limit the max emails returned. This defaults to 20 and has a maximum of 500",
"format": "int64",
"type": "integer"
},
- "pageSize": {
+ "sortMethod": {
"additionalProperties": false,
- "default": 10,
- "description": "Search count per search type (i.e. applies separately to each of documents, emails, ai_conversations, chats, projects). Max is 100. Default is 10. Does not apply when exhaustive_search is set to true.",
- "format": "int64",
- "type": "integer"
+ "default": "viewed_at",
+ "description": "Sort response by one of: viewed_at | updated_at | created_at | viewed_updated. Prefer viewed_at unless the otherwise specified",
+ "enum": [
+ "viewed_at",
+ "updated_at",
+ "created_at",
+ "viewed_updated"
+ ],
+ "type": "string"
},
- "request": {
+ "view": {
"additionalProperties": false,
- "description": "Aggregated search request, see individual fields for details",
+ "default": {
+ "standardLabel": null,
+ "userLabel": null
+ },
+ "description": "Choose the view to list emails from. One of either standard label or user label must be specified, otherwise defaults to important.",
"properties": {
- "filters": {
+ "standardLabel": {
"additionalProperties": false,
- "description": "Search filters for various kinds of items. Set the entire filters property as `null` if you do not have specific filters for a given type, e.g. bcc for email filters.",
- "properties": {
- "channel": {
- "additionalProperties": false,
- "description": "Channel filters. `null` to not filter channels searched over.",
- "properties": {
- "channel_ids": {
- "additionalProperties": false,
- "description": "Channel IDs to search within. Examples: ['general']. Empty to search all accessible channels.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
- },
- "mentions": {
- "additionalProperties": false,
- "description": "Channel user mentions to search for. Examples: ['@username']. Empty if not filtering by mentions.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "description": "Prefer important or all. Leave empty if using a user label",
+ "enum": [
+ "Inbox",
+ "Sent",
+ "Drafts",
+ "Starred",
+ "All",
+ "Important",
+ "Other",
+ null
+ ],
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "userLabel": {
+ "additionalProperties": false,
+ "description": "Choose a custom user label to filter by (optional). Standard label will take precedence over user label if both are specified.",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "standardLabel",
+ "userLabel"
+ ],
+ "type": "object"
+ }
+ },
+ "required": [
+ "cursor",
+ "limit",
+ "sortMethod",
+ "view"
+ ],
+ "title": "ListEmails",
+ "type": "object"
+ },
+ "outputSchema": {
+ "properties": {
+ "items": {
+ "items": {
+ "properties": {
+ "attachments": {
+ "items": {
+ "properties": {
+ "contentId": {
+ "type": [
+ "string",
+ "null"
+ ]
},
- "org_id": {
- "additionalProperties": false,
- "description": "Channel organization ID to search within. Empty to ignore organization filtering.",
+ "createdAt": {
"format": "int64",
+ "type": "integer"
+ },
+ "filename": {
"type": [
- "integer",
+ "string",
"null"
]
},
- "sender_ids": {
- "additionalProperties": false,
- "description": "Sender IDs to search within. Examples: ['user1']. Empty to search all accessible senders.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "id": {
+ "format": "uuid",
+ "type": "string"
},
- "thread_ids": {
- "additionalProperties": false,
- "description": "Channel thread IDs to search within. Examples: ['thread123']. Empty to search all threads.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
- }
- },
- "required": [
- "channel_ids",
- "mentions",
- "org_id",
- "sender_ids",
- "thread_ids"
- ],
- "type": [
- "object",
- "null"
- ]
- },
- "chat": {
- "additionalProperties": false,
- "description": "Chat filters. `null` to not filter chats searched over.",
- "properties": {
- "chat_ids": {
- "additionalProperties": false,
- "description": "Chat ids to search over. Examples: ['chat1'], ['chat1', 'chat2']. When provided, chat search will only match results on these chats. Empty to search all accessible chats.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "messageId": {
+ "format": "uuid",
+ "type": "string"
},
- "owners": {
- "additionalProperties": false,
- "description": "Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "mimeType": {
+ "type": [
+ "string",
+ "null"
+ ]
},
- "project_ids": {
- "additionalProperties": false,
- "description": "A list of project ids to search within. Examples: ['project1']. Empty to ignore project filtering.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "providerAttachmentId": {
+ "type": [
+ "string",
+ "null"
+ ]
},
- "role": {
- "additionalProperties": false,
- "description": "Chat message roles to search. Examples: ['user'], ['assistant']. Empty to search all roles.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "sizeBytes": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
}
},
"required": [
- "chat_ids",
- "owners",
- "project_ids",
- "role"
+ "id",
+ "messageId",
+ "createdAt"
],
- "type": [
- "object",
- "null"
- ]
+ "type": "object"
},
- "document": {
- "additionalProperties": false,
- "description": "Document filters. `null` to not filter documents searched over.",
+ "type": "array"
+ },
+ "contacts": {
+ "items": {
"properties": {
- "document_ids": {
- "additionalProperties": false,
- "description": "Document ids to search over. Examples: ['doc1'], ['doc1', 'doc2']. Empty to search all accessible documents.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "emailAddress": {
+ "type": [
+ "string",
+ "null"
+ ]
},
- "file_types": {
- "additionalProperties": false,
- "description": "Document file types to search. Examples: ['pdf'], ['md', 'txt']. Empty to search all file types.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "id": {
+ "format": "uuid",
+ "type": "string"
},
- "owners": {
- "additionalProperties": false,
- "description": "Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "linkId": {
+ "format": "uuid",
+ "type": "string"
},
- "project_ids": {
- "additionalProperties": false,
- "description": "A list of project ids to search within. Examples: ['project1'].\nfiltering. Empty to ignore project filtering.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "sfsPhotoUrl": {
+ "type": [
+ "string",
+ "null"
+ ]
}
},
"required": [
- "document_ids",
- "file_types",
- "owners",
- "project_ids"
+ "id",
+ "linkId"
],
- "type": [
- "object",
- "null"
- ]
+ "type": "object"
},
- "email": {
- "additionalProperties": false,
- "description": "Email filters. `null` to not filter emails searched over.",
- "properties": {
- "bcc": {
- "additionalProperties": false,
- "description": "Email BCC addresses to filter by. Examples: ['[email protected]']. Empty if not filtering by BCC.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
- },
- "cc": {
- "additionalProperties": false,
- "description": "Email CC addresses to filter by. Examples: ['[email protected]']. Empty if not filtering by CC.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "type": "array"
+ },
+ "createdAt": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "frecencyScore": {
+ "format": "double",
+ "type": [
+ "number",
+ "null"
+ ]
+ },
+ "id": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "inboxVisible": {
+ "type": "boolean"
+ },
+ "isDraft": {
+ "type": "boolean"
+ },
+ "isImportant": {
+ "type": "boolean"
+ },
+ "isRead": {
+ "type": "boolean"
+ },
+ "labels": {
+ "items": {
+ "properties": {
+ "createdAt": {
+ "format": "date-time",
+ "type": "string"
},
- "recipients": {
- "additionalProperties": false,
- "description": "Email Recipient addresses to filter by. Examples: ['[email protected]']. Empty if not filtering by Recipient.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "id": {
+ "format": "uuid",
+ "type": "string"
},
- "senders": {
- "additionalProperties": false,
- "description": "Email sender addresses to filter by. Examples: ['[email protected]']. Empty to search all senders.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "labelListVisibility": {
+ "enum": [
+ "LabelShow",
+ "LabelShowIfUnread",
+ "LabelHide"
+ ],
+ "type": "string"
+ },
+ "linkId": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "messageListVisibility": {
+ "enum": [
+ "Show",
+ "Hide"
+ ],
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "providerLabelId": {
+ "type": "string"
+ },
+ "type": {
+ "enum": [
+ "System",
+ "User"
+ ],
+ "type": "string"
}
},
"required": [
- "bcc",
- "cc",
- "recipients",
- "senders"
+ "id",
+ "linkId",
+ "providerLabelId",
+ "name",
+ "createdAt",
+ "messageListVisibility",
+ "labelListVisibility",
+ "type"
],
- "type": [
- "object",
- "null"
- ]
+ "type": "object"
},
- "project": {
- "additionalProperties": false,
- "description": "Project filters. `null` to not filter projects searched over.",
+ "type": "array"
+ },
+ "macroAttachments": {
+ "items": {
"properties": {
- "owners": {
- "additionalProperties": false,
- "description": "Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "dbId": {
+ "format": "uuid",
+ "type": "string"
},
- "project_ids": {
- "additionalProperties": false,
- "description": "Project IDs to search within. Examples: ['project1']. Empty to search all accessible projects.",
- "items": {
- "additionalProperties": false,
- "type": "string"
- },
- "type": "array"
+ "itemId": {
+ "format": "uuid",
+ "type": "string"
+ },
+ "itemType": {
+ "type": "string"
+ },
+ "messageId": {
+ "format": "uuid",
+ "type": "string"
}
},
"required": [
- "owners",
- "project_ids"
+ "dbId",
+ "messageId",
+ "itemId",
+ "itemType"
],
- "type": [
- "object",
- "null"
- ]
- }
+ "type": "object"
+ },
+ "type": "array"
},
- "required": [
- "channel",
- "chat",
- "document",
- "email",
- "project"
- ],
- "type": [
- "object",
- "null"
- ]
- },
- "include": {
- "additionalProperties": false,
- "default": [],
- "description": "Include specific entity types from search. If empty, all entity types will be searched over. If you are unsure which types to search, use an empty array to search all.",
- "items": {
- "additionalProperties": false,
- "enum": [
- "documents",
- "chats",
- "emails",
- "channels",
- "projects"
+ "metadata": {
+ "properties": {
+ "calendar_invite": {
+ "description": "if any email contains a calendar invite",
+ "type": "boolean"
+ },
+ "generic_sender": {
+ "description": "if any sender in the thread is a generic email",
+ "type": "boolean"
+ },
+ "known_sender": {
+ "description": "if user has previously emailed any sender in the thread",
+ "type": "boolean"
+ },
+ "tabular": {
+ "description": "if any email contains a <table> html tag",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "known_sender",
+ "tabular",
+ "calendar_invite",
+ "generic_sender"
],
- "type": "string"
+ "type": "object"
},
- "type": "array"
- },
- "match_type": {
- "additionalProperties": false,
- "description": "How to match the search terms. 'exact' for precise case-sensitive phrase matches, 'partial' for prefix/partial matches. REQUIRED field.",
- "enum": [
- "exact",
- "partial",
- "regexp"
- ],
- "type": "string"
- },
- "search_on": {
- "additionalProperties": false,
- "default": "content",
- "description": "Fields to search on (Name, Content, NameContent). Defaults to Content",
- "enum": [
- "name",
- "content",
- "name_content"
- ],
- "type": "string"
- },
- "terms": {
- "additionalProperties": false,
- "description": "Multiple distinct search terms as separate strings. Use this for keyword-based searches where you want to find content containing any of these terms. Each term must be at least 3 characters (shorter terms are automatically filtered out). Examples: ['machine', 'learning', 'algorithms'], ['project', 'status', 'update']. `null` this field if searching without text terms to search all. This field matches query string against both name and content.",
- "items": {
- "additionalProperties": false,
+ "name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "ownerId": {
"type": "string"
},
- "type": [
- "array",
- "null"
- ]
- }
- },
- "required": [
- "filters",
- "include",
- "match_type",
- "search_on",
- "terms"
- ],
- "type": "object"
+ "providerId": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "senderEmail": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "senderName": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "senderPhotoUrl": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "snippet": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "sortTs": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "updatedAt": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "viewedAt": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "id",
+ "ownerId",
+ "inboxVisible",
+ "isRead",
+ "isDraft",
+ "isImportant",
+ "sortTs",
+ "createdAt",
+ "updatedAt",
+ "attachments",
+ "macroAttachments",
+ "contacts",
+ "labels",
+ "metadata"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "next_cursor": {
+ "type": [
+ "string",
+ "null"
+ ]
}
},
"required": [
- "exhaustiveSearch",
- "pageOffset",
- "pageSize",
- "request"
+ "items"
],
- "title": "UnifiedSearch",
+ "title": "ApiPaginatedThreadCursor",
+ "type": "object"
+ }
+ },
+ {
+ "name": "Read",
+ "inputSchema": {
+ "additionalProperties": false,
+ "description": "Read content by ID(s). Supports reading documents, channels, chats, and emails by their respective IDs. Use this tool when you need to retrieve the full content of a specific item(s).\n Channel transcripts only include 300 messages. Use 'messages_since' to see messages in a different time window.",
+ "properties": {
+ "contentType": {
+ "additionalProperties": false,
+ "description": "The type of content to read. Choose based on the type of content you want to retrieve.",
+ "enum": [
+ "document",
+ "channel",
+ "channel-message",
+ "chat-thread",
+ "chat-message",
+ "email-thread",
+ "email-message",
+ "project"
+ ],
+ "type": "string"
+ },
+ "ids": {
+ "additionalProperties": false,
+ "description": "ID(s) of the content to read. IMPORTANT: document, channel-message, chat-message, and email-message content types support MULTIPLE ids! For all other content types (channel, chat-thread, email-thread) provide a single id.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "messagesSince": {
+ "additionalProperties": false,
+ "description": "A local datetime of the earliest message to include in a channel transcript ex: 2025-11-25 12:00:09 EST, only applicable to channels",
+ "format": "date-time",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "contentType",
+ "ids",
+ "messagesSince"
+ ],
+ "title": "Read",
"type": "object"
},
"outputSchema": {
"properties": {
- "response": {
- "description": "The search results",
- "properties": {
- "results": {
- "description": "The search results (truncated to `results_returned` limit if applicable)",
- "items": {
- "oneOf": [
- {
+ "content": {
+ "oneOf": [
+ {
+ "properties": {
+ "documents": {
+ "items": {
"properties": {
- "document_id": {
- "description": "The document id",
- "type": "string"
- },
- "document_name": {
- "description": "The document name",
+ "content": {
"type": "string"
},
- "file_type": {
- "description": "The file type",
+ "documentId": {
"type": "string"
},
- "highlight": {
- "description": "The highlights on the document",
+ "metadata": {
"properties": {
- "bcc": {
- "description": "The highlight match on the bcc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "cc": {
- "description": "The highlight match on the cc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
+ "deleted": {
+ "type": "boolean"
},
- "content": {
- "description": "The highlight match on the content field",
- "items": {
- "type": "string"
- },
- "type": "array"
+ "documentName": {
+ "type": "string"
},
- "name": {
- "description": "The highlight match on the name field",
+ "fileType": {
"type": [
"string",
"null"
]
},
- "recipients": {
- "description": "The highlight match on the recipients (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "sender": {
- "description": "The highlight match on the sender (email only)",
- "type": [
- "string",
- "null"
- ]
+ "owner": {
+ "type": "string"
},
- "user_id": {
- "description": "The highlight match on the user (owner) of the entity",
+ "projectId": {
"type": [
"string",
"null"
]
}
},
+ "required": [
+ "documentName",
+ "owner",
+ "deleted"
+ ],
"type": "object"
- },
- "node_id": {
- "description": "The node id",
- "type": "string"
- },
- "owner_id": {
- "description": "The owner id",
- "type": "string"
- },
- "raw_content": {
- "description": "The raw content of the document",
- "type": [
- "string",
- "null"
- ]
- },
- "type": {
- "const": "document",
- "type": "string"
- },
- "updated_at": {
- "description": "The time the document was last updated",
- "format": "date-time",
- "type": "string"
}
},
"required": [
- "type",
- "document_id",
- "document_name",
- "node_id",
- "owner_id",
- "file_type",
- "updated_at",
- "highlight"
+ "documentId",
+ "content",
+ "metadata"
],
"type": "object"
},
- {
+ "type": "array"
+ },
+ "type": {
+ "const": "documents",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "documents"
+ ],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "channel_id": {
+ "type": "string"
+ },
+ "channel_name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "transcript": {
+ "type": "string"
+ },
+ "type": {
+ "const": "channel",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "channel_id",
+ "transcript"
+ ],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "conversation": {
+ "items": {
"properties": {
"chat_id": {
- "description": "The chat id",
- "type": "string"
- },
- "chat_message_id": {
- "description": "The chat message id",
"type": "string"
},
- "highlight": {
- "description": "The highlights on the chat",
- "properties": {
- "bcc": {
- "description": "The highlight match on the bcc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "cc": {
- "description": "The highlight match on the cc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "content": {
- "description": "The highlight match on the content field",
- "items": {
- "type": "string"
+ "messages": {
+ "items": {
+ "properties": {
+ "attachment_summaries": {
+ "items": {
+ "oneOf": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Summary": {
+ "properties": {
+ "created_at": {
+ "format": "date-time",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "document_id": {
+ "type": "string"
+ },
+ "id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "summary": {
+ "type": "string"
+ },
+ "version_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "document_id",
+ "summary",
+ "version_id"
+ ],
+ "type": "object"
+ }
+ },
+ "required": [
+ "Summary"
+ ],
+ "type": "object"
+ },
+ {
+ "additionalProperties": false,
+ "properties": {
+ "NoSummary": {
+ "properties": {
+ "document_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "document_id"
+ ],
+ "type": "object"
+ }
+ },
+ "required": [
+ "NoSummary"
+ ],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "type": "array"
- },
- "name": {
- "description": "The highlight match on the name field",
- "type": [
- "string",
- "null"
- ]
- },
- "recipients": {
- "description": "The highlight match on the recipients (email only)",
- "items": {
+ "content": {
"type": "string"
},
- "type": "array"
- },
- "sender": {
- "description": "The highlight match on the sender (email only)",
- "type": [
- "string",
- "null"
- ]
+ "date": {
+ "format": "date-time",
+ "type": "string"
+ }
},
- "user_id": {
- "description": "The highlight match on the user (owner) of the entity",
- "type": [
- "string",
- "null"
- ]
- }
+ "required": [
+ "content",
+ "date",
+ "attachment_summaries"
+ ],
+ "type": "object"
},
- "type": "object"
- },
- "role": {
- "description": "The role",
- "type": "string"
+ "type": "array"
},
"title": {
- "description": "The title",
- "type": "string"
- },
- "type": {
- "const": "chat",
- "type": "string"
- },
- "updated_at": {
- "description": "The time the chat was last updated",
- "format": "date-time",
- "type": "string"
- },
- "user_id": {
- "description": "The user id",
"type": "string"
}
},
"required": [
- "type",
"chat_id",
- "chat_message_id",
- "user_id",
- "role",
- "updated_at",
"title",
- "highlight"
+ "messages"
],
"type": "object"
},
- {
+ "type": "array"
+ },
+ "type": {
+ "const": "chat",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "conversation"
+ ],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "messages": {
+ "items": {
"properties": {
"bcc": {
- "description": "The bcc",
"items": {
"type": "string"
},
"type": "array"
},
"cc": {
- "description": "The cc",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "highlight": {
- "description": "The highlights on the email",
- "properties": {
- "bcc": {
- "description": "The highlight match on the bcc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "cc": {
- "description": "The highlight match on the cc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "content": {
- "description": "The highlight match on the content field",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "name": {
- "description": "The highlight match on the name field",
- "type": [
- "string",
- "null"
- ]
- },
- "recipients": {
- "description": "The highlight match on the recipients (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "sender": {
- "description": "The highlight match on the sender (email only)",
- "type": [
- "string",
- "null"
- ]
- },
- "user_id": {
- "description": "The highlight match on the user (owner) of the entity",
- "type": [
- "string",
- "null"
- ]
- }
- },
- "type": "object"
- },
- "labels": {
- "description": "The labels",
"items": {
"type": "string"
},
"type": "array"
},
- "link_id": {
- "description": "The link id",
+ "content": {
"type": "string"
},
- "message_id": {
- "description": "The message id",
+ "messageId": {
"type": "string"
},
"recipients": {
- "description": "The recipients",
"items": {
"type": "string"
},
"type": "array"
},
"sender": {
- "description": "The sender",
"type": "string"
},
- "sent_at": {
- "description": "The time the email was sent",
+ "sentAt": {
"format": "date-time",
"type": [
"string",
"null"
]
- },
- "subject": {
- "description": "The subject",
- "type": [
- "string",
- "null"
- ]
- },
- "thread_id": {
- "description": "The thread id",
- "type": "string"
- },
- "type": {
- "const": "email",
- "type": "string"
- },
- "updated_at": {
- "description": "The time the email was last updated",
- "format": "date-time",
- "type": "string"
- },
- "user_id": {
- "description": "The user id",
- "type": "string"
}
},
"required": [
- "type",
- "thread_id",
- "message_id",
+ "messageId",
"sender",
"recipients",
"cc",
"bcc",
- "labels",
- "link_id",
- "user_id",
- "updated_at",
- "highlight"
+ "content"
],
"type": "object"
},
- {
- "properties": {
- "channel_id": {
- "description": "The channel id",
- "type": "string"
- },
- "channel_type": {
- "description": "The channel type",
- "type": "string"
- },
- "created_at": {
- "description": "The time the channel message was created",
- "format": "date-time",
- "type": "string"
- },
- "highlight": {
- "description": "The highlights on the channel message",
- "properties": {
- "bcc": {
- "description": "The highlight match on the bcc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "cc": {
- "description": "The highlight match on the cc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "content": {
- "description": "The highlight match on the content field",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "name": {
- "description": "The highlight match on the name field",
- "type": [
- "string",
- "null"
- ]
- },
- "recipients": {
- "description": "The highlight match on the recipients (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "sender": {
- "description": "The highlight match on the sender (email only)",
- "type": [
- "string",
- "null"
- ]
- },
- "user_id": {
- "description": "The highlight match on the user (owner) of the entity",
- "type": [
- "string",
- "null"
- ]
- }
- },
- "type": "object"
- },
- "mentions": {
- "description": "The mentions",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "message_id": {
- "description": "The message id",
- "type": "string"
- },
- "org_id": {
- "description": "The org id",
- "format": "int64",
- "type": [
- "integer",
- "null"
- ]
- },
- "sender_id": {
- "description": "The sender id",
- "type": "string"
- },
- "thread_id": {
- "description": "The thread id",
- "type": [
- "string",
- "null"
- ]
- },
- "type": {
- "const": "channel",
- "type": "string"
- },
- "updated_at": {
- "description": "The time the channel message was last updated",
- "format": "date-time",
- "type": "string"
- }
- },
- "required": [
- "type",
- "channel_id",
- "channel_type",
- "message_id",
- "sender_id",
- "mentions",
- "created_at",
- "updated_at",
- "highlight"
- ],
- "type": "object"
- },
- {
- "properties": {
- "created_at": {
- "description": "The time the project was created",
- "format": "date-time",
- "type": "string"
- },
- "highlight": {
- "description": "The highlights on the project",
- "properties": {
- "bcc": {
- "description": "The highlight match on the bcc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "cc": {
- "description": "The highlight match on the cc (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "content": {
- "description": "The highlight match on the content field",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "name": {
- "description": "The highlight match on the name field",
- "type": [
- "string",
- "null"
- ]
- },
- "recipients": {
- "description": "The highlight match on the recipients (email only)",
- "items": {
- "type": "string"
- },
- "type": "array"
- },
- "sender": {
- "description": "The highlight match on the sender (email only)",
- "type": [
- "string",
- "null"
- ]
- },
- "user_id": {
- "description": "The highlight match on the user (owner) of the entity",
- "type": [
- "string",
- "null"
- ]
- }
- },
- "type": "object"
- },
- "project_id": {
- "description": "The project id",
- "type": "string"
- },
- "project_name": {
- "description": "The project name",
- "type": "string"
- },
- "type": {
- "const": "project",
- "type": "string"
- },
- "updated_at": {
- "description": "The time the project was last updated",
- "format": "date-time",
- "type": "string"
- },
- "user_id": {
- "description": "The id of the user who created the project",
- "type": "string"
- }
- },
- "required": [
- "type",
- "project_id",
- "updated_at",
- "created_at",
- "project_name",
- "user_id",
- "highlight"
- ],
- "type": "object"
- }
- ]
+ "type": "array"
+ },
+ "subject": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "thread_id": {
+ "type": "string"
+ },
+ "type": {
+ "const": "email",
+ "type": "string"
+ }
},
- "type": "array"
- },
- "resultsReturned": {
- "description": "the number of results returned",
- "format": "uint",
- "minimum": 0,
- "type": "integer"
+ "required": [
+ "type",
+ "thread_id",
+ "messages"
+ ],
+ "type": "object"
},
- "totalResults": {
- "description": "total number of results from search",
- "format": "uint",
- "minimum": 0,
- "type": "integer"
+ {
+ "properties": {
+ "formatted_preview": {
+ "type": "string"
+ },
+ "type": {
+ "const": "itemPreviews",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "formatted_preview"
+ ],
+ "type": "object"
}
- },
- "required": [
- "results",
- "totalResults",
- "resultsReturned"
- ],
- "type": "object"
- },
- "responseSchema": {
- "description": "The JSON schema for the response so the LLM can understand it"
+ ]
}
},
"required": [
- "response",
- "responseSchema"
+ "content"
],
- "title": "UnifiedSearchResponseOutput",
+ "title": "ReadResponse",
"type": "object"
}
},
{
- "name": "ListEmails",
+ "name": "UnifiedSearch",
"inputSchema": {
"additionalProperties": false,
- "description": "List the emails the user has access to. Use this tool to discover and browse emails before using the Read tool to access their content. Prefer using the search tool to search on a specific matching string within the content or the name of the entity.",
+ "description": "Universal search across all content types (documents, emails, AI conversations, chat/slack threads/channels, projects aka folders). This tool will return broad metadata from successful results and/or content matches. Use the Read tool next to read the results from those matches. Only ever refer to documents by name or with a document mention. Never state the id of the document in plaintext. User's are presented with the results of this tool as a UI element so there is no need to enumerate the information found from this tool.",
"properties": {
- "cursor": {
+ "exhaustiveSearch": {
"additionalProperties": false,
- "default": null,
- "description": "A preview response will tell you what the next cursor id is.\n If expected emails are not in the current response and it gives you a cursor id, use this field to list the next page of emails. If no cursor id is provided you've reached the end",
- "type": [
- "string",
- "null"
- ]
+ "default": true,
+ "description": "Exhaustive search across all results matching the query. Defaults to true. Use false when the user only requires a limitied subset of results to answer the question",
+ "type": "boolean"
},
- "limit": {
+ "pageOffset": {
"additionalProperties": false,
- "default": 20,
- "description": "limit the max emails returned. This defaults to 20 and has a maximum of 500",
+ "default": 0,
+ "description": "Page offset. Default is 0. Use a higher offset to page through results intelligently. Set exhaustive_search to true to get all results.",
"format": "int64",
"type": "integer"
},
- "sortMethod": {
+ "pageSize": {
"additionalProperties": false,
- "default": "viewed_at",
- "description": "Sort response by one of: viewed_at | updated_at | created_at | viewed_updated. Prefer viewed_at unless the otherwise specified",
- "enum": [
- "viewed_at",
- "updated_at",
- "created_at",
- "viewed_updated"
- ],
- "type": "string"
+ "default": 10,
+ "description": "Search count per search type (i.e. applies separately to each of documents, emails, ai_conversations, chats, projects). Max is 100. Default is 10. Does not apply when exhaustive_search is set to true.",
+ "format": "int64",
+ "type": "integer"
},
- "view": {
+ "request": {
"additionalProperties": false,
- "default": {
- "standardLabel": null,
- "userLabel": null
- },
- "description": "Choose the view to list emails from. One of either standard label or user label must be specified, otherwise defaults to important.",
+ "description": "Aggregated search request, see individual fields for details",
"properties": {
- "standardLabel": {
- "additionalProperties": false,
- "description": "Prefer important or all. Leave empty if using a user label",
- "enum": [
- "Inbox",
- "Sent",
- "Drafts",
- "Starred",
- "All",
- "Important",
- "Other",
- null
- ],
- "type": [
- "string",
- "null"
- ]
- },
- "userLabel": {
+ "filters": {
"additionalProperties": false,
- "description": "Choose a custom user label to filter by (optional). Standard label will take precedence over user label if both are specified.",
- "type": [
- "string",
- "null"
- ]
- }
- },
- "required": [
- "standardLabel",
- "userLabel"
- ],
- "type": "object"
- }
- },
- "required": [
- "cursor",
- "limit",
- "sortMethod",
- "view"
- ],
- "title": "ListEmails",
- "type": "object"
- },
- "outputSchema": {
- "properties": {
- "items": {
- "items": {
- "properties": {
- "attachments": {
- "items": {
+ "description": "Search filters for various kinds of items. Set the entire filters property as `null` if you do not have specific filters for a given type, e.g. bcc for email filters.",
+ "properties": {
+ "channel": {
+ "additionalProperties": false,
+ "description": "Channel filters. `null` to not filter channels searched over.",
"properties": {
- "contentId": {
- "type": [
- "string",
- "null"
- ]
- },
- "createdAt": {
- "format": "int64",
- "type": "integer"
- },
- "filename": {
- "type": [
- "string",
- "null"
- ]
- },
- "id": {
- "format": "uuid",
- "type": "string"
- },
- "messageId": {
- "format": "uuid",
- "type": "string"
- },
- "mimeType": {
- "type": [
- "string",
- "null"
- ]
+ "channel_ids": {
+ "additionalProperties": false,
+ "description": "Channel IDs to search within. Examples: ['general']. Empty to search all accessible channels.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "providerAttachmentId": {
- "type": [
- "string",
- "null"
- ]
+ "mentions": {
+ "additionalProperties": false,
+ "description": "Channel user mentions to search for. Examples: ['@username']. Empty if not filtering by mentions.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "sizeBytes": {
+ "org_id": {
+ "additionalProperties": false,
+ "description": "Channel organization ID to search within. Empty to ignore organization filtering.",
"format": "int64",
"type": [
"integer",
"null"
]
+ },
+ "sender_ids": {
+ "additionalProperties": false,
+ "description": "Sender IDs to search within. Examples: ['user1']. Empty to search all accessible senders.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "thread_ids": {
+ "additionalProperties": false,
+ "description": "Channel thread IDs to search within. Examples: ['thread123']. Empty to search all threads.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
}
},
"required": [
- "id",
- "messageId",
- "createdAt"
+ "channel_ids",
+ "mentions",
+ "org_id",
+ "sender_ids",
+ "thread_ids"
],
- "type": "object"
+ "type": [
+ "object",
+ "null"
+ ]
},
- "type": "array"
- },
- "contacts": {
- "items": {
+ "chat": {
+ "additionalProperties": false,
+ "description": "Chat filters. `null` to not filter chats searched over.",
"properties": {
- "emailAddress": {
- "type": [
- "string",
- "null"
- ]
- },
- "id": {
- "format": "uuid",
- "type": "string"
+ "chat_ids": {
+ "additionalProperties": false,
+ "description": "Chat ids to search over. Examples: ['chat1'], ['chat1', 'chat2']. When provided, chat search will only match results on these chats. Empty to search all accessible chats.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "linkId": {
- "format": "uuid",
- "type": "string"
+ "owners": {
+ "additionalProperties": false,
+ "description": "Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "name": {
- "type": [
- "string",
- "null"
- ]
+ "project_ids": {
+ "additionalProperties": false,
+ "description": "A list of project ids to search within. Examples: ['project1']. Empty to ignore project filtering.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "sfsPhotoUrl": {
- "type": [
- "string",
- "null"
- ]
+ "role": {
+ "additionalProperties": false,
+ "description": "Chat message roles to search. Examples: ['user'], ['assistant']. Empty to search all roles.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
}
},
"required": [
- "id",
- "linkId"
+ "chat_ids",
+ "owners",
+ "project_ids",
+ "role"
],
- "type": "object"
+ "type": [
+ "object",
+ "null"
+ ]
},
- "type": "array"
- },
- "createdAt": {
- "format": "int64",
- "type": "integer"
- },
- "frecencyScore": {
- "format": "double",
- "type": [
- "number",
- "null"
- ]
- },
- "id": {
- "format": "uuid",
- "type": "string"
- },
- "inboxVisible": {
- "type": "boolean"
- },
- "isDraft": {
- "type": "boolean"
- },
- "isImportant": {
- "type": "boolean"
- },
- "isRead": {
- "type": "boolean"
- },
- "labels": {
- "items": {
+ "document": {
+ "additionalProperties": false,
+ "description": "Document filters. `null` to not filter documents searched over.",
"properties": {
- "createdAt": {
- "format": "date-time",
- "type": "string"
- },
- "id": {
- "format": "uuid",
- "type": "string"
- },
- "labelListVisibility": {
- "enum": [
- "LabelShow",
- "LabelShowIfUnread",
- "LabelHide"
- ],
- "type": "string"
- },
- "linkId": {
- "format": "uuid",
- "type": "string"
- },
- "messageListVisibility": {
- "enum": [
- "Show",
- "Hide"
- ],
- "type": "string"
+ "document_ids": {
+ "additionalProperties": false,
+ "description": "Document ids to search over. Examples: ['doc1'], ['doc1', 'doc2']. Empty to search all accessible documents.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "name": {
- "type": "string"
+ "file_types": {
+ "additionalProperties": false,
+ "description": "Document file types to search. Examples: ['pdf'], ['md', 'txt']. Empty to search all file types.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "providerLabelId": {
- "type": "string"
+ "owners": {
+ "additionalProperties": false,
+ "description": "Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "type": {
- "enum": [
- "System",
- "User"
- ],
- "type": "string"
+ "project_ids": {
+ "additionalProperties": false,
+ "description": "A list of project ids to search within. Examples: ['project1'].\nfiltering. Empty to ignore project filtering.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
}
},
"required": [
- "id",
- "linkId",
- "providerLabelId",
- "name",
- "createdAt",
- "messageListVisibility",
- "labelListVisibility",
- "type"
+ "document_ids",
+ "file_types",
+ "owners",
+ "project_ids"
],
- "type": "object"
+ "type": [
+ "object",
+ "null"
+ ]
},
- "type": "array"
- },
- "macroAttachments": {
- "items": {
+ "email": {
+ "additionalProperties": false,
+ "description": "Email filters. `null` to not filter emails searched over.",
"properties": {
- "dbId": {
- "format": "uuid",
- "type": "string"
+ "bcc": {
+ "additionalProperties": false,
+ "description": "Email BCC addresses to filter by. Examples: ['[email protected]']. Empty if not filtering by BCC.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "itemId": {
- "format": "uuid",
- "type": "string"
+ "cc": {
+ "additionalProperties": false,
+ "description": "Email CC addresses to filter by. Examples: ['[email protected]']. Empty if not filtering by CC.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "itemType": {
- "type": "string"
+ "recipients": {
+ "additionalProperties": false,
+ "description": "Email Recipient addresses to filter by. Examples: ['[email protected]']. Empty if not filtering by Recipient.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
},
- "messageId": {
- "format": "uuid",
- "type": "string"
+ "senders": {
+ "additionalProperties": false,
+ "description": "Email sender addresses to filter by. Examples: ['[email protected]']. Empty to search all senders.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
}
},
"required": [
- "dbId",
- "messageId",
- "itemId",
- "itemType"
+ "bcc",
+ "cc",
+ "recipients",
+ "senders"
],
- "type": "object"
+ "type": [
+ "object",
+ "null"
+ ]
},
- "type": "array"
- },
- "metadata": {
- "properties": {
- "calendar_invite": {
- "description": "if any email contains a calendar invite",
- "type": "boolean"
- },
- "generic_sender": {
- "description": "if any sender in the thread is a generic email",
- "type": "boolean"
- },
- "known_sender": {
- "description": "if user has previously emailed any sender in the thread",
- "type": "boolean"
+ "project": {
+ "additionalProperties": false,
+ "description": "Project filters. `null` to not filter projects searched over.",
+ "properties": {
+ "owners": {
+ "additionalProperties": false,
+ "description": "Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "project_ids": {
+ "additionalProperties": false,
+ "description": "Project IDs to search within. Examples: ['project1']. Empty to search all accessible projects.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": "array"
+ }
},
- "tabular": {
- "description": "if any email contains a <table> html tag",
- "type": "boolean"
- }
- },
- "required": [
- "known_sender",
- "tabular",
- "calendar_invite",
- "generic_sender"
- ],
- "type": "object"
- },
- "name": {
- "type": [
- "string",
- "null"
- ]
+ "required": [
+ "owners",
+ "project_ids"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ }
},
- "ownerId": {
+ "required": [
+ "channel",
+ "chat",
+ "document",
+ "email",
+ "project"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "include": {
+ "additionalProperties": false,
+ "default": [],
+ "description": "Include specific entity types from search. If empty, all entity types will be searched over. If you are unsure which types to search, use an empty array to search all.",
+ "items": {
+ "additionalProperties": false,
+ "enum": [
+ "documents",
+ "chats",
+ "emails",
+ "channels",
+ "projects"
+ ],
"type": "string"
},
- "providerId": {
- "type": [
- "string",
- "null"
- ]
- },
- "senderEmail": {
- "type": [
- "string",
- "null"
- ]
- },
- "senderName": {
- "type": [
- "string",
- "null"
- ]
- },
- "senderPhotoUrl": {
- "type": [
- "string",
- "null"
- ]
- },
- "snippet": {
- "type": [
- "string",
- "null"
- ]
- },
- "sortTs": {
- "format": "int64",
- "type": "integer"
- },
- "updatedAt": {
- "format": "int64",
- "type": "integer"
- },
- "viewedAt": {
- "format": "int64",
- "type": [
- "integer",
- "null"
- ]
- }
+ "type": "array"
},
- "required": [
- "id",
- "ownerId",
- "inboxVisible",
- "isRead",
- "isDraft",
- "isImportant",
- "sortTs",
- "createdAt",
- "updatedAt",
- "attachments",
- "macroAttachments",
- "contacts",
- "labels",
- "metadata"
- ],
- "type": "object"
- },
- "type": "array"
- },
- "next_cursor": {
- "type": [
- "string",
- "null"
- ]
- }
- },
- "required": [
- "items"
- ],
- "title": "ApiPaginatedThreadCursor",
- "type": "object"
- }
- },
- {
- "name": "ListDocuments",
- "inputSchema": {
- "additionalProperties": false,
- "description": "List documents the user has access to with optional filtering and pagination. Only applies to documents, not emails, AI conversations, chat/slack threads, projects aka folders. This tool returns document metadata including access levels and supports filtering by file type, minimum access level, and pagination. Use this tool to discover and browse documents before using the Read tool to access their content. Prefer using the search tool to search on a specific matching string within the content or the name of the entity.",
- "properties": {
- "exhaustiveSearch": {
- "additionalProperties": false,
- "default": false,
- "description": "Exhaustive search to get all results. Defaults to false. Set to true when you need all matching documents, ignoring pagination limits.",
- "type": "boolean"
- },
- "fileTypes": {
- "additionalProperties": false,
- "description": "Document file types to include. Examples: ['pdf'], ['md', 'txt']. Leave empty to include all document types.",
- "items": {
- "additionalProperties": false,
- "type": "string"
+ "match_type": {
+ "additionalProperties": false,
+ "description": "How to match the search terms. 'exact' for precise case-sensitive phrase matches, 'partial' for prefix/partial matches. REQUIRED field.",
+ "enum": [
+ "exact",
+ "partial",
+ "regexp"
+ ],
+ "type": "string"
+ },
+ "search_on": {
+ "additionalProperties": false,
+ "default": "content",
+ "description": "Fields to search on (Name, Content, NameContent). Defaults to Content",
+ "enum": [
+ "name",
+ "content",
+ "name_content"
+ ],
+ "type": "string"
+ },
+ "terms": {
+ "additionalProperties": false,
+ "description": "Multiple distinct search terms as separate strings. Use this for keyword-based searches where you want to find content containing any of these terms. Each term must be at least 3 characters (shorter terms are automatically filtered out). Examples: ['machine', 'learning', 'algorithms'], ['project', 'status', 'update']. `null` this field if searching without text terms to search all. This field matches query string against both name and content.",
+ "items": {
+ "additionalProperties": false,
+ "type": "string"
+ },
+ "type": [
+ "array",
+ "null"
+ ]
+ }
},
- "type": [
- "array",
- "null"
- ]
- },
- "minAccessLevel": {
- "additionalProperties": false,
- "description": "Minimum access level required. Defaults to 'view' if not specified.",
- "enum": [
- "view",
- "comment",
- "edit",
- "owner",
- null
+ "required": [
+ "filters",
+ "include",
+ "match_type",
+ "search_on",
+ "terms"
],
- "type": [
- "string",
- "null"
- ]
- },
- "pageOffset": {
- "additionalProperties": false,
- "default": 0,
- "description": "Page offset for pagination. Default is 0. Use higher values to get subsequent pages of results.",
- "format": "int64",
- "type": "integer"
- },
- "pageSize": {
- "additionalProperties": false,
- "default": 50,
- "description": "Number of results per page. Max is 100, default is 50. Use smaller values for focused results.",
- "format": "int64",
- "type": "integer"
+ "type": "object"
}
},
"required": [
"exhaustiveSearch",
- "fileTypes",
- "minAccessLevel",
"pageOffset",
- "pageSize"
+ "pageSize",
+ "request"
],
- "title": "ListDocuments",
+ "title": "UnifiedSearch",
"type": "object"
},
"outputSchema": {
"properties": {
- "results": {
- "description": "The list results (truncated to `results_returned` limit if applicable)",
- "items": {
- "properties": {
- "access_level": {
- "description": "The user's access level to this document",
- "enum": [
- "view",
- "comment",
- "edit",
- "owner"
- ],
- "type": "string"
- },
- "created_at": {
- "description": "When the document was created",
- "format": "date-time",
- "type": "string"
- },
- "deleted_at": {
- "description": "When the document was deleted (null if not deleted)",
- "format": "date-time",
- "type": [
- "string",
- "null"
- ]
- },
- "document_id": {
- "description": "The document id",
- "type": "string"
- },
- "document_name": {
- "description": "The document name",
- "type": "string"
- },
- "file_type": {
- "description": "The file type of the document",
- "type": [
- "string",
- "null"
- ]
- },
- "owner": {
- "description": "The owner of the document",
- "type": "string"
- },
- "project_id": {
- "description": "The project id containing the document",
- "type": [
- "string",
- "null"
- ]
- },
- "updated_at": {
- "description": "When the document was last updated",
- "format": "date-time",
- "type": "string"
- }
- },
- "required": [
- "document_id",
- "document_name",
- "owner",
- "created_at",
- "updated_at",
- "access_level"
- ],
- "type": "object"
- },
- "type": "array"
- },
- "resultsReturned": {
- "description": "The number of results returned",
- "format": "uint",
- "minimum": 0,
- "type": "integer"
- },
- "totalResults": {
- "description": "Total number of results found",
- "format": "uint",
- "minimum": 0,
- "type": "integer"
- }
- },
- "required": [
- "results",
- "totalResults",
- "resultsReturned"
- ],
- "title": "ListDocumentsResponse",
+ "response": {
+ "description": "The search results",
+ "properties": {
+ "results": {
+ "description": "The search results (truncated to `results_returned` limit if applicable)",
+ "items": {
+ "oneOf": [
+ {
+ "description": "DocumentSearchResponseItem object with document metadata we fetch from macrodb. we don't store these\ntimestamps in opensearch as they would require us to update document page record\nevery time the document updates (specifically for updated_at and viewed_at)",
+ "properties": {
+ "document_id": {
+ "description": "The id of the document",
+ "format": "uuid",
+ "type": "string"
+ },
+ "document_name": {
+ "description": "The name of the document",
+ "type": "string"
+ },
+ "document_search_results": {
+ "description": "The search results for the document\nThis may be empty if the search result match was on the document name only",
+ "items": {
+ "description": "A document match for a given node",
+ "properties": {
+ "highlight": {
+ "description": "The highlights for the document",
+ "properties": {
+ "bcc": {
+ "description": "The highlight match on the bcc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "cc": {
+ "description": "The highlight match on the cc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "content": {
+ "description": "The highlight match on the content field",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "name": {
+ "description": "The highlight match on the name field",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "recipients": {
+ "description": "The highlight match on the recipients (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "sender": {
+ "description": "The highlight match on the sender (email only)",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "user_id": {
+ "description": "The highlight match on the user (owner) of the entity",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "type": "object"
+ },
+ "node_id": {
+ "description": "The node id for the document.\nThis is only useful for markdown at the moment\nThis will only be provided if the match was on content",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "raw_content": {
+ "description": "The raw content of the document.\nThis is only included for markdown files and will be the raw json node of the match",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "score": {
+ "description": "The score of the result",
+ "format": "double",
+ "type": [
+ "number",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "highlight"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "file_type": {
+ "description": "The file type of the document",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "id": {
+ "description": "Standardized fields that all item types will share.\nThese field names are being aligned across all item types\nfor consistency in our data model.",
+ "format": "uuid",
+ "type": "string"
+ },
+ "metadata": {
+ "description": "Metadata from the database. None if the document doesn't exist in the database.",
+ "properties": {
+ "created_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "deleted_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "project_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "updated_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "viewed_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "created_at",
+ "updated_at"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "name": {
+ "type": "string"
+ },
+ "owner_id": {
+ "type": "string"
+ },
+ "sub_type": {
+ "anyOf": [
+ {
+ "description": "The document sub type enum represents all values of document sub types.\nThese values should match the `document_sub_type_value` table in macrodb.",
+ "oneOf": [
+ {
+ "const": "task",
+ "description": "A task document",
+ "type": "string"
+ }
+ ]
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "The sub type of the document if present."
+ },
+ "type": {
+ "const": "document",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "id",
+ "name",
+ "owner_id",
+ "document_id",
+ "document_name",
+ "document_search_results"
+ ],
+ "type": "object"
+ },
+ {
+ "description": "ChatSearchResponse object with channel metadata we fetch from macrodb. we don't store these\ntimestamps in opensearch as they would require us to update each chat message record for the chat\nevery time the chat updates (specifically for updated_at and viewed_at)",
+ "properties": {
+ "chat_id": {
+ "description": "The id of the chat",
+ "format": "uuid",
+ "type": "string"
+ },
+ "chat_search_results": {
+ "description": "The search results for the chat\nThis may be empty if the search result match was on the chat title only",
+ "items": {
+ "description": "A chat match for a given message id",
+ "properties": {
+ "chat_message_id": {
+ "description": "The chat message id for the chat\nThis is only present if the search match was on the chat message content",
+ "format": "uuid",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "highlight": {
+ "description": "The highlights for the chat message",
+ "properties": {
+ "bcc": {
+ "description": "The highlight match on the bcc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "cc": {
+ "description": "The highlight match on the cc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "content": {
+ "description": "The highlight match on the content field",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "name": {
+ "description": "The highlight match on the name field",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "recipients": {
+ "description": "The highlight match on the recipients (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "sender": {
+ "description": "The highlight match on the sender (email only)",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "user_id": {
+ "description": "The highlight match on the user (owner) of the entity",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "type": "object"
+ },
+ "role": {
+ "description": "The role of the chat message\nThis is only present if the search match was on the chat message content",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "score": {
+ "description": "The score of the result",
+ "format": "double",
+ "type": [
+ "number",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "highlight"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "id": {
+ "description": "Standardized fields that all item types will share.\nThese field names are being aligned across all item types\nfor consistency in our data model.",
+ "format": "uuid",
+ "type": "string"
+ },
+ "metadata": {
+ "description": "Metadata from the database. None if the chat doesn't exist in the database.",
+ "properties": {
+ "created_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "deleted_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "project_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "updated_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "viewed_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "created_at",
+ "updated_at"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "name": {
+ "type": "string"
+ },
+ "owner_id": {
+ "type": "string"
+ },
+ "type": {
+ "const": "chat",
+ "type": "string"
+ },
+ "user_id": {
+ "description": "The id of the creator of the chat",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "id",
+ "name",
+ "owner_id",
+ "chat_id",
+ "user_id",
+ "chat_search_results"
+ ],
+ "type": "object"
+ },
+ {
+ "description": "EmailSearchResponseItem object with email metadata we fetch from email service. we don't store these\ntimestamps in opensearch as they would require us to update each email message record for the thread\nevery time the thread updates (specifically for updated_at and viewed_at)",
+ "properties": {
+ "created_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "email_message_search_results": {
+ "description": "The search results for the document\nThis may be empty if the search result match was on the email subject only",
+ "items": {
+ "description": "A email message match for a given thread id",
+ "properties": {
+ "bcc": {
+ "description": "This is only present if the search result is on the message content",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "cc": {
+ "description": "This is only present if the search result is on the message content",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "highlight": {
+ "description": "The highlights for the email message",
+ "properties": {
+ "bcc": {
+ "description": "The highlight match on the bcc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "cc": {
+ "description": "The highlight match on the cc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "content": {
+ "description": "The highlight match on the content field",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "name": {
+ "description": "The highlight match on the name field",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "recipients": {
+ "description": "The highlight match on the recipients (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "sender": {
+ "description": "The highlight match on the sender (email only)",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "user_id": {
+ "description": "The highlight match on the user (owner) of the entity",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "type": "object"
+ },
+ "labels": {
+ "description": "This is only present if the search result is on the message content",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "message_id": {
+ "description": "The email message id.\nThis is only present if the search result is on the message content",
+ "format": "uuid",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "pretty_sender": {
+ "description": "The pretty sender.\nIf the match is on the subject, the pretty sender is the latest sender on the thread.\nThis could be the sender's email if there is no contact name for the sender.",
+ "type": "string"
+ },
+ "recipients": {
+ "description": "This is only present if the search result is on the message content",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "score": {
+ "description": "The score of the result",
+ "format": "double",
+ "type": [
+ "number",
+ "null"
+ ]
+ },
+ "sender": {
+ "description": "The sender.\nIf the match is on the subject, the sender is the latest sender on the thread.",
+ "type": "string"
+ },
+ "sent_at": {
+ "description": "When the email message was sent\nThis is only present if the search result is on the message content",
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "sender",
+ "pretty_sender",
+ "recipients",
+ "cc",
+ "bcc",
+ "labels",
+ "highlight"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "id": {
+ "description": "Standardized fields that all item types will share.\nThese field names are being aligned across all item types\nfor consistency in our data model.",
+ "format": "uuid",
+ "type": "string"
+ },
+ "name": {
+ "description": "Subject of the email thread",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "owner_id": {
+ "type": "string"
+ },
+ "snippet": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "subject": {
+ "description": "The subject of the email\nThis is only present if the search result is on the message content",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "thread_id": {
+ "description": "The id of the email thread",
+ "format": "uuid",
+ "type": "string"
+ },
+ "type": {
+ "const": "email",
+ "type": "string"
+ },
+ "updated_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "user_id": {
+ "description": "The id of the owner of the email thread",
+ "type": "string"
+ },
+ "viewed_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "type",
+ "created_at",
+ "updated_at",
+ "id",
+ "owner_id",
+ "thread_id",
+ "user_id",
+ "email_message_search_results"
+ ],
+ "type": "object"
+ },
+ {
+ "description": "ChannelSearchResponseItem object with channel metadata we fetch from macrodb. we don't store these\ntimestamps in opensearch as they would require us to update each chat message record for the chat\nevery time the chat updates (specifically for updated_at and viewed_at and interacted_at)",
+ "properties": {
+ "channel_id": {
+ "description": "The id of the channel",
+ "format": "uuid",
+ "type": "string"
+ },
+ "channel_message_search_results": {
+ "description": "The search results for the channel\nThis may be empty if the search result match was not on content",
+ "items": {
+ "description": "A channel message match for a given channel id",
+ "properties": {
+ "created_at": {
+ "description": "When the channel message was created\nThis is only prsent if the search result is on the message content",
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "highlight": {
+ "description": "The highlights for the channel message",
+ "properties": {
+ "bcc": {
+ "description": "The highlight match on the bcc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "cc": {
+ "description": "The highlight match on the cc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "content": {
+ "description": "The highlight match on the content field",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "name": {
+ "description": "The highlight match on the name field",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "recipients": {
+ "description": "The highlight match on the recipients (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "sender": {
+ "description": "The highlight match on the sender (email only)",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "user_id": {
+ "description": "The highlight match on the user (owner) of the entity",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "type": "object"
+ },
+ "message_id": {
+ "description": "The channel message id\nThis is only prsent if the search result is on the message content",
+ "format": "uuid",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "score": {
+ "description": "The score of the result",
+ "format": "double",
+ "type": [
+ "number",
+ "null"
+ ]
+ },
+ "sender_id": {
+ "description": "The sender id\nThis is only prsent if the search result is on the message content",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "thread_id": {
+ "description": "The channel message thread id",
+ "format": "uuid",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "updated_at": {
+ "description": "When the channel message was last updated\nThis is only prsent if the search result is on the message content",
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "highlight"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "channel_type": {
+ "description": "The type of channel",
+ "type": "string"
+ },
+ "id": {
+ "description": "Standardized fields that all item types will share.\nThese field names are being aligned across all item types\nfor consistency in our data model.",
+ "format": "uuid",
+ "type": "string"
+ },
+ "metadata": {
+ "description": "Metadata from the database. None if the channel doesn't exist in the database.",
+ "properties": {
+ "created_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "interacted_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "updated_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "viewed_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "created_at",
+ "updated_at"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "owner_id": {
+ "description": "we don't store this for channels atm but keeping it here for consistency",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "type": {
+ "const": "channel",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type",
+ "id",
+ "channel_type",
+ "channel_id",
+ "channel_message_search_results"
+ ],
+ "type": "object"
+ },
+ {
+ "description": "ProjectSearchResponseItem object with project metadata we fetch from macrodb. we don't store these\ntimestamps in opensearch as they would require us to update the project record\nevery time the project updates (specifically for updated_at and viewed_at)",
+ "properties": {
+ "created_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "id": {
+ "description": "Standardized fields that all item types will share.\nThese field names are being aligned across all item types\nfor consistency in our data model.",
+ "format": "uuid",
+ "type": "string"
+ },
+ "metadata": {
+ "description": "Metadata from the database. None if the project doesn't exist in the database.",
+ "properties": {
+ "created_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "deleted_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "parent_project_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "updated_at": {
+ "format": "int64",
+ "type": "integer"
+ },
+ "viewed_at": {
+ "format": "int64",
+ "type": [
+ "integer",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "created_at",
+ "updated_at"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "name": {
+ "type": "string"
+ },
+ "owner_id": {
+ "type": "string"
+ },
+ "project_search_results": {
+ "items": {
+ "properties": {
+ "highlight": {
+ "properties": {
+ "bcc": {
+ "description": "The highlight match on the bcc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "cc": {
+ "description": "The highlight match on the cc (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "content": {
+ "description": "The highlight match on the content field",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "name": {
+ "description": "The highlight match on the name field",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "recipients": {
+ "description": "The highlight match on the recipients (email only)",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "sender": {
+ "description": "The highlight match on the sender (email only)",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "user_id": {
+ "description": "The highlight match on the user (owner) of the entity",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "type": "object"
+ },
+ "score": {
+ "description": "The score of the result",
+ "format": "double",
+ "type": [
+ "number",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "highlight"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "type": {
+ "const": "project",
+ "type": "string"
+ },
+ "updated_at": {
+ "format": "int64",
+ "type": "integer"
+ }
+ },
+ "required": [
+ "type",
+ "id",
+ "name",
+ "owner_id",
+ "updated_at",
+ "created_at",
+ "project_search_results"
+ ],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ "resultsReturned": {
+ "description": "the number of results returned",
+ "format": "uint",
+ "minimum": 0,
+ "type": "integer"
+ },
+ "totalResults": {
+ "description": "total number of results from search",
+ "format": "uint",
+ "minimum": 0,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "results",
+ "totalResults",
+ "resultsReturned"
+ ],
+ "type": "object"
+ },
+ "responseSchema": {
+ "description": "The JSON schema for the response so the LLM can understand it"
+ }
+ },
+ "required": [
+ "response",
+ "responseSchema"
+ ],
+ "title": "UnifiedSearchResponseOutput",
"type": "object"
}
},
diff --git a/rust/cloud-storage/document_sub_type/Cargo.toml b/rust/cloud-storage/document_sub_type/Cargo.toml
index 2411e397c7..87161d124b 100644
--- a/rust/cloud-storage/document_sub_type/Cargo.toml
+++ b/rust/cloud-storage/document_sub_type/Cargo.toml
@@ -10,3 +10,4 @@ sqlx = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }
utoipa = { workspace = true }
+schemars = {workspace = true}
diff --git a/rust/cloud-storage/document_sub_type/src/lib.rs b/rust/cloud-storage/document_sub_type/src/lib.rs
index 3239e6f03c..655cbc6ab6 100644
--- a/rust/cloud-storage/document_sub_type/src/lib.rs
+++ b/rust/cloud-storage/document_sub_type/src/lib.rs
@@ -1,4 +1,5 @@
//! This crate contains the document sub type enum and various logic for it
+use schemars::JsonSchema;
/// The document sub type enum represents all values of document sub types.
/// These values should match the `document_sub_type_value` table in macrodb.
@@ -14,6 +15,7 @@
sqlx::Type,
strum::EnumString,
strum::Display,
+ JsonSchema,
)]
#[serde(rename_all = "lowercase")]
#[strum(serialize_all = "snake_case")]
diff --git a/rust/cloud-storage/models_search/src/channel.rs b/rust/cloud-storage/models_search/src/channel.rs
index 97209e98f1..a9624884ba 100644
--- a/rust/cloud-storage/models_search/src/channel.rs
+++ b/rust/cloud-storage/models_search/src/channel.rs
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
/// A channel message match for a given channel id
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChannelSearchResult {
/// The channel message id
/// This is only prsent if the search result is on the message content
@@ -29,7 +29,7 @@ pub struct ChannelSearchResult {
}
/// A single response item, part of the ChannelSearchResponse object
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChannelSearchResponseItem {
/// Standardized fields that all item types will share.
/// These field names are being aligned across all item types
@@ -48,7 +48,7 @@ pub struct ChannelSearchResponseItem {
}
/// Metadata for a channel fetched from the database
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChannelMetadata {
pub created_at: i64,
pub updated_at: i64,
@@ -59,7 +59,7 @@ pub struct ChannelMetadata {
/// ChannelSearchResponseItem object with channel metadata we fetch from macrodb. we don't store these
/// timestamps in opensearch as they would require us to update each chat message record for the chat
/// every time the chat updates (specifically for updated_at and viewed_at and interacted_at)
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChannelSearchResponseItemWithMetadata {
/// Metadata from the database. None if the channel doesn't exist in the database.
pub metadata: Option<ChannelMetadata>,
diff --git a/rust/cloud-storage/models_search/src/chat.rs b/rust/cloud-storage/models_search/src/chat.rs
index 62a74b13ff..6366b5b087 100644
--- a/rust/cloud-storage/models_search/src/chat.rs
+++ b/rust/cloud-storage/models_search/src/chat.rs
@@ -6,7 +6,7 @@ use utoipa::ToSchema;
use crate::{MatchType, SearchHighlight, SearchOn, SearchResponseItem};
/// A chat match for a given message id
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChatMessageSearchResult {
/// The chat message id for the chat
/// This is only present if the search match was on the chat message content
@@ -22,7 +22,7 @@ pub struct ChatMessageSearchResult {
}
/// A single response item, part of the ChatSearchResponse object
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChatSearchResponseItem {
/// Standardized fields that all item types will share.
/// These field names are being aligned across all item types
@@ -41,7 +41,7 @@ pub struct ChatSearchResponseItem {
}
/// Metadata for a chat fetched from the database
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChatMetadata {
pub created_at: i64,
pub updated_at: i64,
@@ -53,7 +53,7 @@ pub struct ChatMetadata {
/// ChatSearchResponse object with channel metadata we fetch from macrodb. we don't store these
/// timestamps in opensearch as they would require us to update each chat message record for the chat
/// every time the chat updates (specifically for updated_at and viewed_at)
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ChatSearchResponseItemWithMetadata {
/// Metadata from the database. None if the chat doesn't exist in the database.
pub metadata: Option<ChatMetadata>,
diff --git a/rust/cloud-storage/models_search/src/document.rs b/rust/cloud-storage/models_search/src/document.rs
index ff2d05626f..0d9aabd2e9 100644
--- a/rust/cloud-storage/models_search/src/document.rs
+++ b/rust/cloud-storage/models_search/src/document.rs
@@ -7,7 +7,7 @@ use utoipa::ToSchema;
use crate::{MatchType, SearchHighlight, SearchOn};
/// A document match for a given node
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct DocumentSearchResult {
/// The node id for the document.
/// This is only useful for markdown at the moment
@@ -24,7 +24,7 @@ pub struct DocumentSearchResult {
}
/// A single response item, part of the DocumentSearchResponse object
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct DocumentSearchResponseItem {
/// Standardized fields that all item types will share.
/// These field names are being aligned across all item types
@@ -46,7 +46,7 @@ pub struct DocumentSearchResponseItem {
}
/// Metadata for a document fetched from the database
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct DocumentMetadata {
pub created_at: i64,
pub updated_at: i64,
@@ -58,7 +58,7 @@ pub struct DocumentMetadata {
/// DocumentSearchResponseItem object with document metadata we fetch from macrodb. we don't store these
/// timestamps in opensearch as they would require us to update document page record
/// every time the document updates (specifically for updated_at and viewed_at)
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct DocumentSearchResponseItemWithMetadata {
/// Metadata from the database. None if the document doesn't exist in the database.
pub metadata: Option<DocumentMetadata>,
diff --git a/rust/cloud-storage/models_search/src/email.rs b/rust/cloud-storage/models_search/src/email.rs
index d9a159ef98..37406ac2fc 100644
--- a/rust/cloud-storage/models_search/src/email.rs
+++ b/rust/cloud-storage/models_search/src/email.rs
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
/// A email message match for a given thread id
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct EmailSearchResult {
/// The email message id.
/// This is only present if the search result is on the message content
@@ -36,7 +36,7 @@ pub struct EmailSearchResult {
}
/// A single response item, part of the EmailSearchResponse object
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct EmailSearchResponseItem {
/// Standardized fields that all item types will share.
/// These field names are being aligned across all item types
@@ -62,7 +62,7 @@ pub struct EmailSearchResponseItem {
/// EmailSearchResponseItem object with email metadata we fetch from email service. we don't store these
/// timestamps in opensearch as they would require us to update each email message record for the thread
/// every time the thread updates (specifically for updated_at and viewed_at)
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct EmailSearchResponseItemWithMetadata {
pub created_at: i64,
pub updated_at: i64,
diff --git a/rust/cloud-storage/models_search/src/project.rs b/rust/cloud-storage/models_search/src/project.rs
index 49b4231dbb..b5f7b105e5 100644
--- a/rust/cloud-storage/models_search/src/project.rs
+++ b/rust/cloud-storage/models_search/src/project.rs
@@ -4,7 +4,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ProjectSearchResult {
pub highlight: SearchHighlight,
/// The score of the result
@@ -23,7 +23,7 @@ pub struct ProjectSearchMetadata {
}
/// A single response item, part of the ProjectSearchResponse object
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ProjectSearchResponseItem {
/// Standardized fields that all item types will share.
/// These field names are being aligned across all item types
@@ -38,7 +38,7 @@ pub struct ProjectSearchResponseItem {
}
/// Metadata for a project fetched from the database
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ProjectMetadata {
pub created_at: i64,
pub updated_at: i64,
@@ -50,7 +50,7 @@ pub struct ProjectMetadata {
/// ProjectSearchResponseItem object with project metadata we fetch from macrodb. we don't store these
/// timestamps in opensearch as they would require us to update the project record
/// every time the project updates (specifically for updated_at and viewed_at)
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
pub struct ProjectSearchResponseItemWithMetadata {
/// Metadata from the database. None if the project doesn't exist in the database.
pub metadata: Option<ProjectMetadata>,
diff --git a/rust/cloud-storage/models_search/src/simple.rs b/rust/cloud-storage/models_search/src/simple.rs
index 91348986f1..f57ab582f5 100644
--- a/rust/cloud-storage/models_search/src/simple.rs
+++ b/rust/cloud-storage/models_search/src/simple.rs
@@ -1,7 +1,8 @@
+use schemars::JsonSchema;
use utoipa::ToSchema;
/// The search service version of a highlight
-#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema, JsonSchema)]
pub struct Highlight {
/// If the match was on the entity name, this will be present with that highlight
#[serde(skip_serializing_if = "Option::is_none")]
@@ -12,7 +13,7 @@ pub struct Highlight {
pub content: Vec<String>,
}
-#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema, JsonSchema)]
pub struct SearchGotoDocument {
/// The node id of the document
/// This can be a stringified page number 0-indexed for pdf/docx files,
@@ -22,7 +23,7 @@ pub struct SearchGotoDocument {
pub raw_content: Option<String>,
}
-#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema, JsonSchema)]
pub struct SearchGotoChat {
/// The chat message id
pub chat_message_id: uuid::Uuid,
@@ -30,7 +31,7 @@ pub struct SearchGotoChat {
pub role: String,
}
-#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema, JsonSchema)]
pub struct SearchGotoEmail {
/// The email message id
pub email_message_id: uuid::Uuid,
@@ -42,14 +43,14 @@ pub struct SearchGotoEmail {
pub recipients: Vec<String>,
}
-#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema, JsonSchema)]
pub struct SearchGotoChannel {
/// The channel message id
pub channel_message_id: uuid::Uuid,
}
/// The search service version of a goto
-#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema, JsonSchema)]
#[serde(untagged)]
pub enum SearchGotoContent {
Documents(SearchGotoDocument),
@@ -94,7 +95,7 @@ impl From<opensearch_client::search::model::SearchGotoContent> for SearchGotoCon
}
/// Simple response item to mimic what we get back from opensearch
-#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema, JsonSchema)]
pub struct SimpleSearchResponseItem {
pub entity_id: uuid::Uuid,
pub entity_type: String,
@@ -105,7 +106,7 @@ pub struct SimpleSearchResponseItem {
}
/// The response for simple search
-#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema, JsonSchema)]
pub struct SimpleSearchResponse {
pub results: Vec<SimpleSearchResponseItem>,
}
diff --git a/rust/cloud-storage/models_search/src/unified.rs b/rust/cloud-storage/models_search/src/unified.rs
index a25c093d2d..8111231460 100644
--- a/rust/cloud-storage/models_search/src/unified.rs
+++ b/rust/cloud-storage/models_search/src/unified.rs
@@ -121,7 +121,7 @@ impl Default for UnifiedSearchFilters {
}
}
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
+#[derive(Debug, Serialize, Deserialize, ToSchema, JsonSchema)]
#[serde(rename_all = "camelCase", tag = "type")]
pub enum UnifiedSearchResponseItem {
Document(DocumentSearchResponseItemWithMetadata),
diff --git a/rust/cloud-storage/search_service_client/src/search_unified.rs b/rust/cloud-storage/search_service_client/src/search_unified.rs
index 10791e40ec..c4b2cbcf06 100644
--- a/rust/cloud-storage/search_service_client/src/search_unified.rs
+++ b/rust/cloud-storage/search_service_client/src/search_unified.rs
@@ -1,5 +1,4 @@
use crate::{SearchServiceClient, constants::INTERNAL_MACRO_USER_ID_HEADER};
-use models_search::TimestampField;
impl SearchServiceClient {
pub async fn search_unified(
@@ -38,13 +37,13 @@ impl SearchServiceClient {
}
}
- pub async fn search_simple_unified<T: TimestampField>(
+ pub async fn search_simple_unified(
&self,
user_id: &str,
body: models_search::unified::UnifiedSearchRequest,
page: i64,
page_size: i64,
- ) -> anyhow::Result<models_search::unified::SimpleUnifiedSearchBaseResponse<T>> {
+ ) -> anyhow::Result<models_search::SimpleSearchResponse> {
let res = self
.client
.post(format!(
@@ -58,9 +57,7 @@ impl SearchServiceClient {
match res.status() {
reqwest::StatusCode::OK => {
- let result = res
- .json::<models_search::unified::SimpleUnifiedSearchBaseResponse<T>>()
- .await?;
+ let result = res.json::<models_search::SimpleSearchResponse>().await?;
Ok(result)
}
status_code => {