Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(ai): nested tool subcontext + docs + gen (#1112)
Eric Hayes9b3e27a8cf64
diff --git a/js/app/package.json b/js/app/package.jsonindex f2bc0d885f..52dac1d591 100644--- a/js/app/package.json+++ b/js/app/package.json@@ -12,6 +12,7 @@"build": "cd packages/app && MODE=development NODE_ENV=production bun run --bun build","test": "bunx vitest run","gen-api": "bun scripts/generate-api-schema.ts",+ "gen-tools": "bun scripts/generate-dcs-tools.ts","check": "tsc --noEmit --skipLibCheck --project packages/app/tsconfig.json","preview": "cd packages/app && bun run --bun preview:dev","lint": "bunx --bun biome lint --skip=nursery/noImportCycles",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.tsindex b8ad705c3b..003d217816 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@@ -1,4 +1,4 @@-/* Generated by scripts/generate-ai-tools.ts+/* Generated by scripts/generate-dcs-tools.ts* *DO NOT EDIT MANUALLY***/diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/tool.ts b/js/app/packages/service-clients/service-cognition/generated/tools/tool.tsindex 0029da6c47..22e50cd6b1 100644--- a/js/app/packages/service-clients/service-cognition/generated/tools/tool.ts+++ b/js/app/packages/service-clients/service-cognition/generated/tools/tool.ts@@ -1,4 +1,4 @@-/* Generated by scripts/generate-ai-tools.ts+/* Generated by scripts/generate-dcs-tools.ts* *DO NOT EDIT MANUALLY***/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.tsindex 5324e09170..77aa527acc 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@@ -1,4 +1,4 @@-/* Generated by scripts/generate-ai-tools.ts+/* Generated by scripts/generate-dcs-tools.ts* *DO NOT EDIT MANUALLY***/diff --git a/js/app/scripts/generate-dcs-tools.ts b/js/app/scripts/generate-dcs-tools.tsindex 95dfcb84a0..9b5e69ad7c 100644--- a/js/app/scripts/generate-dcs-tools.ts+++ b/js/app/scripts/generate-dcs-tools.ts@@ -1,7 +1,7 @@// Usage:-// bun run scripts/generate-ai-tools-types.ts+// bun run scripts/generate-dcs-tools.ts//-// This script fetches AI tool schemas from the document-cognition service+// This script generates AI tool schemas by running the local Rust binary// and generates TS types for use in the chat block and service package.import { mkdir, readFile } from "node:fs/promises";@@ -12,7 +12,11 @@ import { resolveRefs } from "json-refs";import { compile } from "json-schema-to-typescript";import { jsonSchemaToZod } from "json-schema-to-zod";import { z } from "zod";-import { documentCognitionBase, serviceUrl } from "./services";+import { documentCognitionBase } from "./services";++const rustCloudStorageDir = path.resolve(import.meta.dirname, "../../../rust/cloud-storage");+const aiToolsDir = path.join(rustCloudStorageDir, "ai_tools");+const schemasJsonPath = path.join(aiToolsDir, "schemas", "tools.json");/*** Pre-process JSON Schema to convert $ref with sibling properties into allOf.@@ -75,7 +79,7 @@ const toolFile = join(outputDir, "tool.ts");await $`rm ${schemasFile} ${toolFile} ${typesFile}|| true`;-const warning = `/* Generated by scripts/generate-ai-tools.ts+const warning = `/* Generated by scripts/generate-dcs-tools.ts* *DO NOT EDIT MANUALLY***/`;@@ -94,11 +98,26 @@ const AiToolsResponseSchema = z.object({type AiToolsResponse = z.infer<typeof AiToolsResponseSchema>["schemas"];+async function buildAndRunSchemaGenerator(): Promise<void> {+ console.log("Building gen_tool_schemas binary...");+ await $`cd ${rustCloudStorageDir} && SQLX_OFFLINE=true cargo build --release -p ai_tools --bin gen_tool_schemas`;+ console.log("Build complete.");++ // Remove existing schemas dir if it exists (the binary expects to create it)+ await $`rm -rf ${path.join(aiToolsDir, "schemas")}`.quiet();++ console.log("Running gen_tool_schemas...");+ const binaryPath = path.join(rustCloudStorageDir, "target", "release", "gen_tool_schemas");+ await $`cd ${aiToolsDir} && ${binaryPath}`;+ console.log("Schema generation complete.");+}+async function fetchAIToolsSchemas(): Promise<AiToolsResponse> {- const path =- "../../rust/cloud-storage/document_cognition_service/schemas/tools.json";try {- const data = await readFile(path, "utf-8");+ // Build and run the Rust binary to generate schemas+ await buildAndRunSchemaGenerator();++ const data = await readFile(schemasJsonPath, "utf-8");const parsed = AiToolsResponseSchema.parse(JSON.parse(data));console.log(`Successfully loaded ${parsed.schemas.length} AI tool schemas`);return parsed.schemas;diff --git a/rust/cloud-storage/.gitignore b/rust/cloud-storage/.gitignoreindex e4c8272eb0..8353bd8b53 100644--- a/rust/cloud-storage/.gitignore+++ b/rust/cloud-storage/.gitignore@@ -1,6 +1,9 @@# Ignore everything in target/target/*+# Generated tool schemas (generated by gen-api script)+ai_tools/schemas/+# But keep the lambda directory!/target/lambda/diff --git a/rust/cloud-storage/ai_tools/src/bin/gen_tool_schemas.rs b/rust/cloud-storage/ai_tools/src/bin/gen_tool_schemas.rsnew file mode 100644index 0000000000..0d790224bd--- /dev/null+++ b/rust/cloud-storage/ai_tools/src/bin/gen_tool_schemas.rs@@ -0,0 +1,9 @@+//! Binary to generate tool schemas JSON file.++fn main() {+ let schemas = ai_tools::all_tool_schemas();+ let json = serde_json::to_string_pretty(&schemas).expect("serialize schemas");+ std::fs::create_dir("schemas").expect("create schemas dir");+ std::fs::write("schemas/tools.json", &json).expect("write tools.json");+ println!("Generated ai_tools/schemas/tools.json");+}diff --git a/rust/cloud-storage/ai_toolset/CLAUDE.md b/rust/cloud-storage/ai_toolset/CLAUDE.mdindex b1db116e02..feb2a7a36f 100644--- a/rust/cloud-storage/ai_toolset/CLAUDE.md+++ b/rust/cloud-storage/ai_toolset/CLAUDE.md@@ -1,3 +1,5 @@You are not allowed to _EVER_ change this crate.-Guidelines for writing toolsets are in TOOLS.md+Guidelines for writing toolsets are in TOOL_DESIGN.md++Guidelines for integrating tools are in TOOL_INTEGRATION.mddiff --git a/rust/cloud-storage/ai_toolset/TOOLS.md b/rust/cloud-storage/ai_toolset/TOOL_DESIGN.mdsimilarity index 100%rename from rust/cloud-storage/ai_toolset/TOOLS.mdrename to rust/cloud-storage/ai_toolset/TOOL_DESIGN.mddiff --git a/rust/cloud-storage/ai_toolset/TOOL_INTEGRATION.md b/rust/cloud-storage/ai_toolset/TOOL_INTEGRATION.mdnew file mode 100644index 0000000000..eac2f492a3--- /dev/null+++ b/rust/cloud-storage/ai_toolset/TOOL_INTEGRATION.md@@ -0,0 +1,24 @@+A tool depends on dependencies that are injected via context. Dependencies+are usually things like connections to services, and databases.++If a group of tools share the same dependencies and do similar things they should+be grouped into a toolset. Toolsets are composable and may++The toolset object is defined so that it can provide _subcontext_ (a small peice of+a large context) to tools. The example in `lib.rs` demonstrates this by+narrowing a context with 2 objects to a context with a single object.++UI is created on the frontend for every tool. To support this, toolsets generate+schemas for all of their tools that the frontend transpiles into ts types. Any tool+added to the `all_tools` toolset (or nested in a subtoolset) will have types generated.++To write new tools:+1. Define the context (what does your tool need??)+2. Define your tool/s and toolset that depends on this context+3. Add to the parent context of `all_tool`+ - if a field of subtools is the context you need then your context is derivable+4. Add your toolset as a subtoolset to the `all_tools` toolset in `ai_tools`+5. Generate schemas by running the binary in `ai_tools` with `cargo run --bin gen_tool_schemas`+6. Generate the frontend types by running naving to `js/app` and running `bun gen-tools`.+7. Use `bun check` will fail and tell you what you need to implement.+8. Implement the handlers / renderers and verify with `bun check`diff --git a/rust/cloud-storage/ai_toolset/src/lib.rs b/rust/cloud-storage/ai_toolset/src/lib.rsindex 3a67327bf2..bc5f3d5be2 100644--- a/rust/cloud-storage/ai_toolset/src/lib.rs+++ b/rust/cloud-storage/ai_toolset/src/lib.rs@@ -76,6 +76,56 @@//! .add_tool::<ReadDocumentTool, Arc<dyn DocumentApi>>().unwrap()//! .add_tool::<UpdatePropertyTool, Arc<dyn PropertyApi>>().unwrap();//! ```+//!+//! # Nested Toolsets+//!+//! Toolsets can be composed by merging a subtoolset with a narrower context into+//! a parent toolset with a broader context. The subtoolset's context must be+//! derivable from the parent context via `FromRef`.+//!+//! ```+//! use ai_toolset::{AsyncTool, AsyncToolSet, RequestContext, ServiceContext, ToolResult};+//! use axum_macros::FromRef;+//! use schemars::JsonSchema;+//! use serde::{Deserialize, Serialize};+//! use std::sync::Arc;+//!+//! // Narrower context for a subset of tools+//! #[derive(Clone)]+//! struct SubContext {+//! sub_api: Arc<String>,+//! }+//!+//! // Broader parent context that contains SubContext+//! #[derive(Clone, FromRef)]+//! struct ParentContext {+//! sub: SubContext,+//! other_api: Arc<String>,+//! }+//!+//! // A tool that works with SubContext+//! #[derive(JsonSchema, Deserialize)]+//! #[schemars(title = "SubTool", description = "A tool using SubContext")]+//! struct SubTool { value: String }+//!+//! #[async_trait::async_trait]+//! impl AsyncTool<SubContext> for SubTool {+//! type Output = serde_json::Value;+//! async fn call(&self, ctx: ServiceContext<SubContext>, _req: RequestContext) -> ToolResult<Self::Output> {+//! Ok(serde_json::json!({"value": self.value, "api": *ctx.sub_api}))+//! }+//! }+//!+//! // Build a subtoolset with the narrower context+//! let sub_toolset = AsyncToolSet::<SubContext>::new()+//! .add_tool::<SubTool, SubContext>().unwrap();+//!+//! // Merge into parent toolset - tools are automatically widened+//! let parent_toolset = AsyncToolSet::<ParentContext>::new()+//! .add_subtoolset::<SubContext>(sub_toolset).unwrap();+//!+//! assert!(parent_toolset.tools.contains_key("SubTool"));+//! ```#![deny(missing_docs)]diff --git a/rust/cloud-storage/ai_toolset/src/toolset/mod.rs b/rust/cloud-storage/ai_toolset/src/toolset/mod.rsindex eb2a3281d4..8a3f835256 100644--- a/rust/cloud-storage/ai_toolset/src/toolset/mod.rs+++ b/rust/cloud-storage/ai_toolset/src/toolset/mod.rs@@ -2,4 +2,5 @@pub mod tool_object;mod types;+pub use types::*;diff --git a/rust/cloud-storage/ai_toolset/src/toolset/tool_object/tool_async.rs b/rust/cloud-storage/ai_toolset/src/toolset/tool_object/tool_async.rsindex b869b32955..1913385c18 100644--- a/rust/cloud-storage/ai_toolset/src/toolset/tool_object/tool_async.rs+++ b/rust/cloud-storage/ai_toolset/src/toolset/tool_object/tool_async.rs@@ -75,6 +75,35 @@ where/// Trait object type for tools callable with `ToolSetContext`.type AsyncToolTraitObject<ToolSetContext> = Box<dyn ToolSetCallable<ToolSetContext> + Send + Sync>;+/// Adapter that wraps a `ToolSetCallable<SubContext>` to work with `ParentContext`.+///+/// This enables toolset nesting: tools from a subtoolset with a narrower context+/// can be widened to work with a parent toolset's broader context.+struct SubContextAdapter<ParentContext, SubContext>+where+ SubContext: FromRef<ParentContext>,+{+ callable: Box<dyn ToolSetCallable<SubContext> + Send + Sync>,+ _phantom: std::marker::PhantomData<fn(&ParentContext) -> SubContext>,+}++#[async_trait]+impl<ParentContext, SubContext> ToolSetCallable<ParentContext>+ for SubContextAdapter<ParentContext, SubContext>+where+ ParentContext: Send + Sync,+ SubContext: FromRef<ParentContext> + Send + Sync,+{+ async fn call(+ &self,+ context: ParentContext,+ request_context: RequestContext,+ ) -> ToolResult<serde_json::Value> {+ let sub_context = SubContext::from_ref(&context);+ self.callable.call(sub_context, request_context).await+ }+}+/// Deserializer function type that creates a callable tool from JSON.type AsyncDeserializer<ToolSetContext> = Box<dyn Fn(&serde_json::Value) -> Result<AsyncToolTraitObject<ToolSetContext>, serde_json::Error>@@ -145,4 +174,85 @@ wheredeserializer,})}++ /// Widens this tool object to work with a broader parent context.+ ///+ /// This enables toolset composition: a tool originally created for `SubContext`+ /// can be transformed to work with `ParentContext`, as long as `SubContext`+ /// can be derived from `ParentContext` via `FromRef`.+ ///+ /// # Type Parameters+ ///+ /// - `ParentContext`: The broader context type to widen to+ ///+ /// # Example+ ///+ /// ```+ /// use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolResult};+ /// use ai_toolset::tool_object::AsyncToolObject;+ /// use axum_macros::FromRef;+ /// use schemars::JsonSchema;+ /// use serde::{Deserialize, Serialize};+ /// use std::sync::Arc;+ ///+ /// // Narrower context+ /// #[derive(Clone)]+ /// struct SubContext {+ /// api: Arc<String>,+ /// }+ ///+ /// // Broader parent context+ /// #[derive(Clone, FromRef)]+ /// struct ParentContext {+ /// sub: SubContext,+ /// other: Arc<String>,+ /// }+ ///+ /// // A tool that works with SubContext+ /// #[derive(JsonSchema, Deserialize)]+ /// #[schemars(title = "MyTool", description = "Example tool")]+ /// struct MyTool { input: String }+ ///+ /// #[async_trait::async_trait]+ /// impl AsyncTool<SubContext> for MyTool {+ /// type Output = serde_json::Value;+ /// async fn call(&self, _ctx: ServiceContext<SubContext>, _req: RequestContext) -> ToolResult<Self::Output> {+ /// Ok(serde_json::json!({"input": self.input}))+ /// }+ /// }+ ///+ /// // Create tool for SubContext+ /// let tool: AsyncToolObject<SubContext> =+ /// AsyncToolObject::try_from_tool::<MyTool, SubContext, _>().unwrap();+ ///+ /// // Widen to work with ParentContext+ /// let widened: AsyncToolObject<ParentContext> = tool.widen::<ParentContext>();+ ///+ /// assert_eq!(widened.name, "MyTool");+ /// ```+ pub fn widen<ParentContext>(self) -> AsyncToolObject<ParentContext>+ where+ ParentContext: Send + Sync + 'static,+ ToolSetContext: FromRef<ParentContext> + Send + Sync + 'static,+ {+ let old_deserializer = self.deserializer;++ let new_deserializer: AsyncDeserializer<ParentContext> =+ Box::new(move |data: &serde_json::Value| {+ old_deserializer(data).map(|callable| {+ Box::new(SubContextAdapter {+ callable,+ _phantom: std::marker::PhantomData::<fn(&ParentContext) -> ToolSetContext>,+ }) as AsyncToolTraitObject<ParentContext>+ })+ });++ ToolObject {+ name: self.name,+ input_schema: self.input_schema,+ output_schema: self.output_schema,+ description: self.description,+ deserializer: new_deserializer,+ }+ }}diff --git a/rust/cloud-storage/ai_toolset/src/toolset/types.rs b/rust/cloud-storage/ai_toolset/src/toolset/types.rsindex abfbbdc0fd..5a48f5bd06 100644--- a/rust/cloud-storage/ai_toolset/src/toolset/types.rs+++ b/rust/cloud-storage/ai_toolset/src/toolset/types.rs@@ -1,3 +1,4 @@+//! typesuse super::tool_object::{AsyncToolObject, ValidationError};use crate::RequestContext;use crate::{AsyncTool, ToolResult};@@ -140,4 +141,74 @@ where})?;Ok(tool.call(context, request_context).await)}++ /// Merges a subtoolset with a narrower context into this toolset.+ ///+ /// The subtoolset's context type (`SubContext`) must be derivable from this+ /// toolset's context (`ToolSetContext`) via `FromRef`. Each tool from the+ /// subtoolset is widened to work with the parent context before being added.+ ///+ /// Returns an error if any tool names conflict between the two toolsets.+ ///+ /// # Example+ ///+ /// ```+ /// use ai_toolset::{AsyncTool, AsyncToolSet, RequestContext, ServiceContext, ToolResult};+ /// use axum_macros::FromRef;+ /// use schemars::JsonSchema;+ /// use serde::{Deserialize, Serialize};+ /// use std::sync::Arc;+ ///+ /// // Narrower context for a subset of tools+ /// #[derive(Clone)]+ /// struct SubContext {+ /// sub_api: Arc<String>,+ /// }+ ///+ /// // Broader parent context that contains SubContext+ /// #[derive(Clone, FromRef)]+ /// struct ParentContext {+ /// sub: SubContext,+ /// other_api: Arc<String>,+ /// }+ ///+ /// // A tool that works with SubContext+ /// #[derive(JsonSchema, Deserialize)]+ /// #[schemars(title = "SubTool", description = "A tool using SubContext")]+ /// struct SubTool { value: String }+ ///+ /// #[async_trait::async_trait]+ /// impl AsyncTool<SubContext> for SubTool {+ /// type Output = serde_json::Value;+ /// async fn call(&self, ctx: ServiceContext<SubContext>, _req: RequestContext) -> ToolResult<Self::Output> {+ /// Ok(serde_json::json!({"value": self.value, "api": *ctx.sub_api}))+ /// }+ /// }+ ///+ /// // Build a subtoolset with the narrower context+ /// let sub_toolset = AsyncToolSet::<SubContext>::new()+ /// .add_tool::<SubTool, SubContext>().unwrap();+ ///+ /// // Merge into parent toolset - tools are automatically widened+ /// let parent_toolset = AsyncToolSet::<ParentContext>::new()+ /// .add_subtoolset::<SubContext>(sub_toolset).unwrap();+ ///+ /// assert!(parent_toolset.tools.contains_key("SubTool"));+ /// ```+ pub fn add_subtoolset<SubContext>(+ mut self,+ subtoolset: AsyncToolSet<SubContext>,+ ) -> Result<Self, ToolSetCreationError>+ where+ SubContext: FromRef<ToolSetContext> + Send + Sync + 'static,+ {+ for (name, tool) in subtoolset.tools {+ if self.tools.contains_key(&name) {+ return Err(ToolSetCreationError::NameConflict(name));+ }+ let widened = tool.widen::<ToolSetContext>();+ self.tools.insert(name, widened);+ }+ Ok(self)+ }}diff --git a/rust/cloud-storage/document_cognition_service/schemas/tools.json b/rust/cloud-storage/document_cognition_service/schemas/tools.jsondeleted file mode 100644index d8bd49ae48..0000000000--- a/rust/cloud-storage/document_cognition_service/schemas/tools.json+++ /dev/null@@ -1,3644 +0,0 @@-{- "schemas": [- {- "name": "MarkdownRewrite",- "inputSchema": {- "additionalProperties": false,- "description": "Instruct an agent to edit a markdown file identified by an id.\n This tool should be used when the user include a markdown file in context and requests a revision or edit to that file",- "properties": {- "instructions": {- "additionalProperties": false,- "description": "Instructions for the revision agent to follow to edit the markdown. These instructions will be provided by the user.",- "type": "string"- },- "markdown_file_id": {- "additionalProperties": false,- "description": "The markdown file id to target for editing. This file id will be in your context and labeled as a markdown (md) document",- "type": "string"- }- },- "required": [- "instructions",- "markdown_file_id"- ],- "title": "MarkdownRewrite",- "type": "object"- },- "outputSchema": {- "additionalProperties": false,- "properties": {- "diffs": {- "items": {- "additionalProperties": false,- "properties": {- "markdown_text": {- "type": "string"- },- "node_key": {- "type": "string"- },- "operation": {- "type": "string"- }- },- "required": [- "operation",- "node_key",- "markdown_text"- ],- "type": "object"- },- "type": "array"- }- },- "required": [- "diffs"- ],- "title": "AIDiffResponse",- "type": "object"- }- },- {- "name": "ListEmails",- "inputSchema": {- "additionalProperties": false,- "description": "List the emails the user has access to. Use this tool to find all emails from / to a specific person. Prefer using the search tool to search on a specific matching string within the content or the name of the entity.",- "properties": {- "cursor": {- "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"- ]- },- "limit": {- "additionalProperties": false,- "default": 20,- "description": "limit the max emails returned. This defaults to 20 and has a maximum of 500",- "format": "int64",- "type": "integer"- },- "sortMethod": {- "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"- },- "view": {- "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.",- "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": {- "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"- ]- },- "createdAt": {- "format": "int64",- "type": "integer"- },- "filename": {- "type": [- "string",- "null"- ]- },- "id": {- "format": "uuid",- "type": "string"- },- "messageId": {- "format": "uuid",- "type": "string"- },- "mimeType": {- "type": [- "string",- "null"- ]- },- "providerAttachmentId": {- "type": [- "string",- "null"- ]- },- "sizeBytes": {- "format": "int64",- "type": [- "integer",- "null"- ]- }- },- "required": [- "id",- "messageId",- "createdAt"- ],- "type": "object"- },- "type": "array"- },- "contacts": {- "items": {- "properties": {- "emailAddress": {- "type": [- "string",- "null"- ]- },- "id": {- "format": "uuid",- "type": "string"- },- "linkId": {- "format": "uuid",- "type": "string"- },- "name": {- "type": [- "string",- "null"- ]- },- "sfsPhotoUrl": {- "type": [- "string",- "null"- ]- }- },- "required": [- "id",- "linkId"- ],- "type": "object"- },- "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"- },- "id": {- "format": "uuid",- "type": "string"- },- "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": [- "id",- "linkId",- "providerLabelId",- "name",- "createdAt",- "messageListVisibility",- "labelListVisibility",- "type"- ],- "type": "object"- },- "type": "array"- },- "macroAttachments": {- "items": {- "properties": {- "dbId": {- "format": "uuid",- "type": "string"- },- "itemId": {- "format": "uuid",- "type": "string"- },- "itemType": {- "type": "string"- },- "messageId": {- "format": "uuid",- "type": "string"- }- },- "required": [- "dbId",- "messageId",- "itemId",- "itemType"- ],- "type": "object"- },- "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"- },- "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"- ]- },- "ownerId": {- "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"- ]- }- },- "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": "NameSearch",- "inputSchema": {- "additionalProperties": false,- "description": "Search for items by their name or title. For documents, this searches the document name. For emails, this searches the subject line. For chats, this searches the chat title. For projects (folders), this searches the project name. This tool finds items based on what they're called, not their content.",- "properties": {- "entityTypes": {- "additionalProperties": false,- "default": [],- "description": "Which types of items to search. Leave empty to search all types. Examples: ['documents'], ['emails', 'documents'], ['channels']",- "items": {- "additionalProperties": false,- "enum": [- "documents",- "chats",- "emails",- "channels",- "projects"- ],- "type": "string"- },- "type": "array"- },- "name": {- "additionalProperties": false,- "description": "The name or title to search for. For emails, this is the subject line. For channels, this can be the channel name or participant names.",- "type": "string"- }- },- "required": [- "entityTypes",- "name"- ],- "title": "NameSearch",- "type": "object"- },- "outputSchema": {- "properties": {- "results": {- "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"- }- },- "required": [- "results"- ],- "title": "SearchToolResponse",- "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": {- "content": {- "oneOf": [- {- "properties": {- "documents": {- "items": {- "properties": {- "formattedDocument": {- "type": "string"- }- },- "required": [- "formattedDocument"- ],- "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": {- "type": "string"- },- "messages": {- "items": {- "properties": {- "attachmentIds": {- "items": {- "type": "string"- },- "type": "array"- },- "content": {- "type": "string"- },- "date": {- "format": "date-time",- "type": "string"- }- },- "required": [- "content",- "date",- "attachmentIds"- ],- "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": [- "content"- ],- "title": "ReadResponse",- "type": "object"- }- },- {- "name": "ContentSearch",- "inputSchema": {- "additionalProperties": false,- "description": "Search for items by their content. For documents, this searches the document body text. For emails, this searches the email message body. For chats, this searches the message content. This tool finds items based on what's inside them, not their titles or names.",- "properties": {- "entityTypes": {- "additionalProperties": false,- "default": [],- "description": "Which types of items to search. Leave empty to search all types. Examples: ['documents'], ['emails', 'documents'], ['channels']",- "items": {- "additionalProperties": false,- "enum": [- "documents",- "chats",- "emails",- "channels",- "projects"- ],- "type": "string"- },- "type": "array"- },- "query": {- "additionalProperties": false,- "description": "The text content to search for. This searches within the body of documents, emails, and messages.",- "type": "string"- }- },- "required": [- "entityTypes",- "query"- ],- "title": "ContentSearch",- "type": "object"- },- "outputSchema": {- "properties": {- "results": {- "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"- }- },- "required": [- "results"- ],- "title": "SearchToolResponse",- "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"- },- "type": [- "array",- "null"- ]- },- "minAccessLevel": {- "additionalProperties": false,- "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": [- "exhaustiveSearch",- "fileTypes",- "minAccessLevel",- "pageOffset",- "pageSize"- ],- "title": "ListDocuments",- "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",- "type": "object"- }- },- {- "name": "ListChannels",- "inputSchema": {- "additionalProperties": false,- "description": "List all chat channels the user has access to. Returns channel names, IDs, and types. Use this tool to discover available channels for reading messages or participating in conversations.",- "properties": {- "unused": {- "additionalProperties": false,- "default": null,- "type": "null"- }- },- "required": [- "unused"- ],- "title": "ListChannels",- "type": "object"- },- "outputSchema": {- "description": "Response from listing channels",- "properties": {- "channels": {- "description": "The list of channels the user has access to",- "items": {- "description": "A channel item returned by the list channels tool",- "properties": {- "channelType": {- "description": "The type of channel (public, private, organization, or direct_message)",- "enum": [- "public",- "organization",- "private",- "direct_message"- ],- "type": "string"- },- "id": {- "description": "The channel's unique identifier",- "format": "uuid",- "type": "string"- },- "name": {- "description": "The channel's display name (may be None for direct messages)",- "type": [- "string",- "null"- ]- }- },- "required": [- "id",- "channelType"- ],- "type": "object"- },- "type": "array"- },- "total": {- "description": "Total number of channels returned",- "format": "uint",- "minimum": 0,- "type": "integer"- }- },- "required": [- "channels",- "total"- ],- "title": "ListChannelsResponse",- "type": "object"- }- },- {- "name": "web_search",- "inputSchema": {- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "This is the expected shape of the streamed json following a `server_tool_use` in content_block_start event",- "properties": {- "query": {- "type": "string"- }- },- "required": [- "query"- ],- "title": "WebSearchToolCall",- "type": "object"- },- "outputSchema": {- "$defs": {- "SearchResult": {- "description": "A single search result from web search",- "oneOf": [- {- "properties": {- "title": {- "type": "string"- },- "type": {- "const": "web_search_result",- "type": "string"- },- "url": {- "type": "string"- }- },- "required": [- "type",- "title",- "url"- ],- "type": "object"- }- ]- }- },- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "Web search response content returned by Claude when using the web_search tool",- "properties": {- "content": {- "description": "The search query that was executed\nArray of search results",- "items": {- "$ref": "#/$defs/SearchResult"- },- "type": "array"- },- "tool_use_id": {- "type": "string"- }- },- "required": [- "content",- "tool_use_id"- ],- "title": "WebSearchResponse",- "type": "object"- }- },- {- "name": "web_fetch",- "inputSchema": {- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "The expected shape of the streamed JSON following a `server_tool_use` in content_block_start event",- "properties": {- "url": {- "type": "string"- }- },- "required": [- "url"- ],- "title": "WebFetchToolCall",- "type": "object"- },- "outputSchema": {- "$defs": {- "CitationsConfig": {- "description": "Citations configuration for web fetch",- "properties": {- "enabled": {- "type": "boolean"- }- },- "required": [- "enabled"- ],- "type": "object"- },- "WebFetchContent": {- "description": "Content of a web fetch response - either a successful result or an error",- "oneOf": [- {- "$ref": "#/$defs/WebFetchResult",- "properties": {- "type": {- "const": "web_fetch_result",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- },- {- "$ref": "#/$defs/WebFetchToolError",- "properties": {- "type": {- "const": "web_fetch_tool_result_error",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- }- ]- },- "WebFetchDocument": {- "description": "Document content from a web fetch",- "properties": {- "citations": {- "anyOf": [- {- "$ref": "#/$defs/CitationsConfig"- },- {- "type": "null"- }- ],- "description": "Optional citations configuration"- },- "source": {- "$ref": "#/$defs/WebFetchSource",- "description": "The source content (text or base64)"- },- "title": {- "description": "Optional title of the document",- "type": [- "string",- "null"- ]- }- },- "required": [- "source"- ],- "type": "object"- },- "WebFetchErrorCode": {- "description": "Possible error codes for web fetch failures",- "oneOf": [- {- "const": "invalid_input",- "description": "Invalid URL format",- "type": "string"- },- {- "const": "url_too_long",- "description": "URL exceeds maximum length (250 characters)",- "type": "string"- },- {- "const": "url_not_allowed",- "description": "URL blocked by domain filtering rules and model restrictions",- "type": "string"- },- {- "const": "url_not_accessible",- "description": "Failed to fetch content (HTTP error)",- "type": "string"- },- {- "const": "too_many_requests",- "description": "Rate limit exceeded",- "type": "string"- },- {- "const": "unsupported_content_type",- "description": "Content type not supported (only text and PDF)",- "type": "string"- },- {- "const": "max_uses_exceeded",- "description": "Maximum web fetch tool uses exceeded",- "type": "string"- },- {- "const": "unavailable",- "description": "An internal error occurred",- "type": "string"- }- ]- },- "WebFetchResult": {- "description": "Successful web fetch result containing the fetched content",- "properties": {- "content": {- "$ref": "#/$defs/WebFetchDocument",- "description": "The fetched document content"- },- "retrieved_at": {- "description": "Timestamp when the content was retrieved",- "type": "string"- },- "url": {- "description": "The URL that was fetched",- "type": "string"- }- },- "required": [- "url",- "content",- "retrieved_at"- ],- "type": "object"- },- "WebFetchSource": {- "description": "Source content of a fetched document",- "oneOf": [- {- "description": "Plain text content",- "properties": {- "data": {- "type": "string"- },- "media_type": {- "type": "string"- },- "type": {- "const": "text",- "type": "string"- }- },- "required": [- "type",- "media_type",- "data"- ],- "type": "object"- },- {- "description": "Base64-encoded content (e.g., PDF)",- "properties": {- "data": {- "type": "string"- },- "media_type": {- "type": "string"- },- "type": {- "const": "base64",- "type": "string"- }- },- "required": [- "type",- "media_type",- "data"- ],- "type": "object"- }- ]- },- "WebFetchToolError": {- "description": "Error returned when web fetch fails",- "properties": {- "error_code": {- "$ref": "#/$defs/WebFetchErrorCode"- }- },- "required": [- "error_code"- ],- "type": "object"- }- },- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "Web fetch tool response content returned by Claude when using the web_fetch tool",- "properties": {- "content": {- "$ref": "#/$defs/WebFetchContent"- },- "tool_use_id": {- "type": "string"- }- },- "required": [- "tool_use_id",- "content"- ],- "title": "WebFetchResponse",- "type": "object"- }- },- {- "name": "bash_code_execution",- "inputSchema": {- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "The expected shape of the streamed JSON following a `server_tool_use` for bash_code_execution",- "properties": {- "command": {- "description": "The bash command to execute",- "type": "string"- }- },- "required": [- "command"- ],- "title": "BashCodeExecutionToolCall",- "type": "object"- },- "outputSchema": {- "$defs": {- "BashCodeExecutionContent": {- "description": "Content of a bash code execution response - either a result or an error",- "oneOf": [- {- "$ref": "#/$defs/BashCodeExecutionResult",- "properties": {- "type": {- "const": "bash_code_execution_result",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- },- {- "$ref": "#/$defs/BashCodeExecutionToolError",- "properties": {- "type": {- "const": "bash_code_execution_tool_result_error",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- }- ]- },- "BashCodeExecutionResult": {- "description": "Successful bash code execution result",- "properties": {- "content": {- "description": "Files generated during execution",- "items": {- "$ref": "#/$defs/CodeExecutionFile"- },- "type": [- "array",- "null"- ]- },- "return_code": {- "description": "Exit code (0 for success, non-zero for failure)",- "format": "int32",- "type": "integer"- },- "stderr": {- "description": "Standard error from the command",- "type": "string"- },- "stdout": {- "description": "Standard output from the command",- "type": "string"- }- },- "required": [- "stdout",- "stderr",- "return_code"- ],- "type": "object"- },- "BashCodeExecutionToolError": {- "description": "Error from bash code execution",- "properties": {- "error_code": {- "$ref": "#/$defs/CodeExecutionErrorCode"- }- },- "required": [- "error_code"- ],- "type": "object"- },- "CodeExecutionErrorCode": {- "description": "Error codes for code execution failures",- "oneOf": [- {- "const": "unavailable",- "description": "The tool is temporarily unavailable",- "type": "string"- },- {- "const": "execution_time_exceeded",- "description": "Execution exceeded maximum time limit",- "type": "string"- },- {- "const": "container_expired",- "description": "Container expired and is no longer available",- "type": "string"- },- {- "const": "invalid_tool_input",- "description": "Invalid parameters provided to the tool",- "type": "string"- },- {- "const": "too_many_requests",- "description": "Rate limit exceeded for tool usage",- "type": "string"- },- {- "const": "file_not_found",- "description": "File doesn't exist (for view/edit operations) - text_editor only",- "type": "string"- },- {- "const": "string_not_found",- "description": "The old_str not found in file (for str_replace) - text_editor only",- "type": "string"- }- ]- },- "CodeExecutionFile": {- "description": "A file generated during code execution",- "properties": {- "file_id": {- "description": "File ID for retrieval via Files API",- "type": "string"- }- },- "required": [- "file_id"- ],- "type": "object"- }- },- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "Response from bash_code_execution tool",- "properties": {- "content": {- "$ref": "#/$defs/BashCodeExecutionContent"- },- "tool_use_id": {- "type": "string"- }- },- "required": [- "tool_use_id",- "content"- ],- "title": "BashCodeExecutionResponse",- "type": "object"- }- },- {- "name": "text_editor_code_execution",- "inputSchema": {- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "The expected shape of the streamed JSON following a `server_tool_use` for text_editor_code_execution",- "properties": {- "command": {- "description": "The command to execute: \"view\", \"create\", or \"str_replace\"",- "type": "string"- },- "file_text": {- "description": "File content for create operations",- "type": [- "string",- "null"- ]- },- "new_str": {- "description": "Replacement string for str_replace operations",- "type": [- "string",- "null"- ]- },- "old_str": {- "description": "String to find for str_replace operations",- "type": [- "string",- "null"- ]- },- "path": {- "description": "Path to the file",- "type": "string"- }- },- "required": [- "command",- "path"- ],- "title": "TextEditorCodeExecutionToolCall",- "type": "object"- },- "outputSchema": {- "$defs": {- "CodeExecutionErrorCode": {- "description": "Error codes for code execution failures",- "oneOf": [- {- "const": "unavailable",- "description": "The tool is temporarily unavailable",- "type": "string"- },- {- "const": "execution_time_exceeded",- "description": "Execution exceeded maximum time limit",- "type": "string"- },- {- "const": "container_expired",- "description": "Container expired and is no longer available",- "type": "string"- },- {- "const": "invalid_tool_input",- "description": "Invalid parameters provided to the tool",- "type": "string"- },- {- "const": "too_many_requests",- "description": "Rate limit exceeded for tool usage",- "type": "string"- },- {- "const": "file_not_found",- "description": "File doesn't exist (for view/edit operations) - text_editor only",- "type": "string"- },- {- "const": "string_not_found",- "description": "The old_str not found in file (for str_replace) - text_editor only",- "type": "string"- }- ]- },- "TextEditorCodeExecutionContent": {- "description": "Content of a text editor code execution response - either a result or an error",- "oneOf": [- {- "$ref": "#/$defs/TextEditorCodeExecutionResult",- "properties": {- "type": {- "const": "text_editor_code_execution_view_result",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- },- {- "$ref": "#/$defs/TextEditorCodeExecutionResult",- "properties": {- "type": {- "const": "text_editor_code_execution_create_result",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- },- {- "$ref": "#/$defs/TextEditorCodeExecutionResult",- "properties": {- "type": {- "const": "text_editor_code_execution_str_replace_result",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- },- {- "$ref": "#/$defs/TextEditorCodeExecutionToolError",- "properties": {- "type": {- "const": "text_editor_code_execution_tool_result_error",- "type": "string"- }- },- "required": [- "type"- ],- "type": "object"- }- ]- },- "TextEditorCodeExecutionResult": {- "description": "Result from text editor operations (view, create, str_replace)\nFields are optional as different operations return different fields",- "properties": {- "content": {- "description": "File content (for view operations)",- "type": [- "string",- "null"- ]- },- "file_type": {- "description": "Type of file (e.g., \"text\")",- "type": [- "string",- "null"- ]- },- "is_file_update": {- "description": "Whether the file already existed (true = update, false = create)",- "type": [- "boolean",- "null"- ]- },- "lines": {- "description": "Diff lines (prefixed with +/-)",- "items": {- "type": "string"- },- "type": [- "array",- "null"- ]- },- "newLines": {- "description": "Number of new lines",- "format": "uint32",- "minimum": 0,- "type": [- "integer",- "null"- ]- },- "newStart": {- "description": "New content start line",- "format": "uint32",- "minimum": 0,- "type": [- "integer",- "null"- ]- },- "numLines": {- "description": "Number of lines returned",- "format": "uint32",- "minimum": 0,- "type": [- "integer",- "null"- ]- },- "oldLines": {- "description": "Number of old lines changed",- "format": "uint32",- "minimum": 0,- "type": [- "integer",- "null"- ]- },- "oldStart": {- "description": "Old content start line",- "format": "uint32",- "minimum": 0,- "type": [- "integer",- "null"- ]- },- "startLine": {- "description": "Starting line number",- "format": "uint32",- "minimum": 0,- "type": [- "integer",- "null"- ]- },- "totalLines": {- "description": "Total lines in file",- "format": "uint32",- "minimum": 0,- "type": [- "integer",- "null"- ]- }- },- "type": "object"- },- "TextEditorCodeExecutionToolError": {- "description": "Error from text editor code execution",- "properties": {- "error_code": {- "$ref": "#/$defs/CodeExecutionErrorCode"- }- },- "required": [- "error_code"- ],- "type": "object"- }- },- "$schema": "https://json-schema.org/draft/2020-12/schema",- "description": "Response from text_editor_code_execution tool",- "properties": {- "content": {- "$ref": "#/$defs/TextEditorCodeExecutionContent"- },- "tool_use_id": {- "type": "string"- }- },- "required": [- "tool_use_id",- "content"- ],- "title": "TextEditorCodeExecutionResponse",- "type": "object"- }- }- ]-}\ No newline at end of filediff --git a/rust/cloud-storage/document_cognition_service/src/main.rs b/rust/cloud-storage/document_cognition_service/src/main.rsindex 22b012479b..0c52135bfb 100644--- a/rust/cloud-storage/document_cognition_service/src/main.rs+++ b/rust/cloud-storage/document_cognition_service/src/main.rs@@ -32,12 +32,6 @@ async fn main() -> anyhow::Result<()> {tracing::info!("initialized config");- if matches!(config.environment, Environment::Local) {- let tool_schemas =- serde_json::to_string_pretty(&ai_tools::all_tool_schemas()).expect("tool schemas");- std::fs::write("schemas/tools.json", tool_schemas).expect("write_tool_schema");- }-let (min_connections, max_connections): (u32, u32) = match config.environment {Environment::Production => (5, 30),Environment::Develop => (3, 20),