Tool Factory
Tools are created using thecreateChatTools factory function:
Workspace Tools
createNote
Create a new note card in the workspace.The title of the note card
The markdown body content. DO NOT repeat title in content. Start with subheadings/text.
Optional sources from web search or deep research
updateNote
Update an existing note with targeted edits or full rewrite.The name of the note to update (fuzzy matched)
Text to find. Use
'' for full rewrite. For targeted edit: exact text from readWorkspace Content section.Replacement text (entire note if oldString is empty)
Replace every occurrence of oldString; use for renaming or changing repeated text
New title for the note. If not provided, existing title is preserved.
deleteItem
Permanently delete a card/note from the workspace by name.Item name or virtual path (e.g.,
pdfs/Report.pdf) to deleteselectCards
Select cards by their titles and add them to conversation context.Array of card titles to search for and select
Whether the operation succeeded
Number of cards successfully selected
Descriptive message about the selection result
Flashcard Tools
createFlashcards
Create a new flashcard deck.The title of the flashcard deck (defaults to ‘Flashcard Deck’ if not provided)
Array of flashcard objects, each with ‘front’ and ‘back’ properties (minimum 1 card)
updateFlashcards
Add more flashcards to an existing flashcard deck and/or update its title.The name or ID of the flashcard deck to update
Array of flashcard objects to add
New title for the flashcard deck
Quiz Tools
createQuiz
Create an interactive quiz. Extract topic from user message. Use selected cards as context if available.The topic or specific focus instructions for the quiz - extract from user’s message
Content from selected cards in system context if available
The specific number of questions requested by the user (1-50)
IDs of source cards
Names of source cards
updateQuiz
Update quiz title and/or add more questions. Can use new topic, selected cards, or general knowledge.The name of the quiz to update (fuzzy matched)
New title for the quiz
New topic for questions
Content from newly selected cards in system context
Number of questions to add (1-50)
Search & Code Tools
webSearch
Search the web for current information using Google Search with grounding.The search query to look up on the web (1-500 characters)
Synthesized search results with summary and key findings
Array of source objects with
title and urlGoogle grounding metadata with chunks
executeCode
Execute Python code for calculations, data processing, algorithms, or mathematical computations.Description of the task to solve with code
searchWorkspace
Grep-like text search across workspace content (notes, flashcards, PDFs, quizzes, audio transcripts).Search pattern (plain text or regex) — the term/phrase to find in workspace content
Filter by item type, e.g.,
"note", "flashcard", "pdf"Virtual path prefix to scope search, e.g.,
"Physics/" for items under Physics folderreadWorkspace
Read content of a workspace item (note, flashcard deck, PDF summary, quiz) by path or name.Virtual path (e.g.,
Physics/notes/Thermodynamics.md) — unambiguous when duplicates existName for fuzzy match — use when path unknown
1-based line number to start from. Use with limit for pagination.
Max lines to return (max 2000). Use with lineStart for pagination.
For PDFs only: 1-indexed start page (e.g., 5 for page 5)
For PDFs only: 1-indexed end page inclusive (e.g., 10 for pages 5–10)
File & URL Processing Tools
processFiles
Process and analyze files including PDFs, images, documents, and videos.Array of file/video URLs to process (Supabase storage URLs or YouTube URLs)
Workspace item names or virtual paths (e.g.,
"Annual Report" or "pdfs/Annual Report.pdf")Images from PDFs — map placeholder names to base64 for analysis
Set to true to bypass cached PDF content and re-analyze the file
- PDFs: Extracted via Azure Document AI OCR (cached after first extraction)
- Images: JPEG, PNG, GIF, WebP, SVG
- Videos: YouTube URLs (native Gemini support)
- Documents: DOC, DOCX, TXT
processUrls
Analyze web pages using Google’s URL Context API.JSON string containing an object with ‘urls’ (array of web URLs).Example:
'{"urls": ["https://example.com"]}'- Extracts content from regular web URLs (http/https)
- Supports up to 20 URLs per request
- Automatically falls back between scraping methods
- Returns analyzed content with sources
YouTube Tools
searchYoutube
Search for YouTube videos.The search query for YouTube videos
Whether the search succeeded
Array of video objects with id, title, thumbnail, etc.
addYoutubeVideo
Add a YouTube video to the workspace.The YouTube Video ID (not the full URL)
The title of the video
Tool Context
All workspace tools receive a shared context:- Security: Ensures user has access to workspace
- Scoping: Operations limited to current workspace
- Context: Tools can reference active folder for new items
Error Handling
All tools return consistent error structures:- Item not found: Suggests available items or paths
- No workspace context: User must be in a workspace
- Permission denied: User lacks access to workspace
- Invalid input: Validation error with requirements