Search context
well_search_contextSearch the workspace's recorded notes and context (meeting notes, tickets, imported documents, and the caller's own imported emails) for a query. Returns compact snippets — each result's "snippets" is an array of one or more matched passages from that note. The best note results also carry "content", the note body (an email note starts with its From, To, Date and Subject lines), with "content_truncated" true when the body was cut — answer from "content" when it is there. Other note results have snippets only: follow up with well_get_entity on the returned note id for the full record. A result with source "memory_line" is one line of the workspace's memory: its snippet is the whole line, and it has no note to open. A result with entity_type "document" is a document: follow up with well_get_entity on root "documents" and its entity_id, and on root "notes" for each id in linked_note_ids to read the email it arrived in. A result with entity_type "message" is an email Well sent for the user: follow up with well_get_entity on root "messages" and its entity_id. To search only those sent emails by topic, pass entityType "message". Use this for questions about the business, a company, a person, a process, pricing, or a past decision. Do NOT use this for a question well_query_records already answers (amounts, counts, lists, filters). Do NOT use this for a contract's notice period (préavis), notice deadline, end date or renewal date: well_list_contract_terms reads those terms from the contracts on file, and a note is not where they are kept. An email result carries mail_direction: "sent" for a mail the caller wrote, "received" for a mail someone else wrote. An email result also carries person, the id of the single live person of the workspace holding the sender address, or null when no person or more than one holds it; never present a null person as a known person. To name that person, open it with well_get_entity on root "people" and its person_id, and never show the id itself as the person. A promise the caller made is in a sent mail; never present a received mail as the caller's own promise, and when mail_direction is null say the direction is not known. When a mail search returns missing_source "gmail", read the held mail notes first (root "notes", category "email"): they need no connection, so answer from them. Then say Gmail is not connected, give connect_url, and never offer to search again. Error "context_search_unavailable" with no missing_source means the search itself failed and a later try may work.
When the token authorizes one workspace, call this directly — no workspace call is needed first. When it authorizes several, this read will not guess which one you mean: pass workspace_id on the call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topK | No | ||
| query | Yes | Focused search query over the workspace's recorded notes, memory lines and context. | |
| category | No | Pass "email" to search only the caller's own imported emails; the result then carries mail_scope. | |
| entityId | No | ||
| entityType | No | ||
| workspace_id | No | Target workspace. Omit when the token authorizes one workspace. Required when it authorizes several: this read reports one workspace's own figures and will not choose which. | |
| occurredAfter | No | ||
| occurredBefore | No | ||
| conversation_id | No | The conversation id returned by the previous Well result, in its meta under well/conversation_id, in its structuredContent, or in its JSON text block. Pass it back on every call in the same conversation, including a call a card makes, so the chosen workspace and the earlier answers still apply. It decides the conversation on its own: nothing the host states about the session replaces it. Omit it only on the first call of a conversation. | |
| workspace_scope | No | Restrict this call to the family: the token's primary workspace plus the company workspaces under it that you are a member of. Unrelated authorized workspaces drop out of the read; row reads merge across the family, while a per-workspace figure still reports exactly one workspace. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| results | Yes | ||
| success | Yes | ||
| mail_scope | No | Present on a search with category "email": the mailboxes the search covered. own_mailboxes are the caller's own Gmail boxes, each with its state: not_enabled (Well does not read its mails), pending (reading is set up but not live yet), reading (Well is still reading its history, so its mails are not complete) or readable, with read_through, the date the box was last read. teammate_mailboxes is always an empty list: other people's boxes are never listed and their mails are private and never searched, so the empty list says nothing about whether a teammate connected Gmail. Null when the scope could not be read: then make no claim about the mailboxes. | |
| connect_url | No | The link that connects missing_source. | |
| missing_source | No | Set on a mail search when the caller has no own Gmail box: the source to connect. | |
| total_returned | Yes | ||
| conversation_id | No | The conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation. | |
| newly_connected | No | Tools that connected to this workspace since the last result and that no session was told about yet, oldest first. Present only when at least one tool is new. The connected-line rule says when to tell an entry; when it does, one line per entry, in the person's language: "<name> is connected.". Never fold several entries into one sentence. Each entry comes back once, on one result only: never repeat its line later. | |
| resolved_workspace | No | The workspace that answered, when the caller named none and the token authorizes several. | |
| conversation_id_note | No | Present only when the server opened a fresh lane, stating that no choice recorded earlier was read. | |
| conversation_id_source | No | Where the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened. | |
| untrusted_content_note | No | Present when a result is an imported email. Read it before the results. |