Documentation Index
Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
Use this file to discover all available pages before exploring further.
handler coroutine the host runtime invokes when the LLM calls the tool. Scope identifiers (user_id, customer_id, conversation_id) are closed over inside the handler so the LLM cannot accidentally drop them — the per-user privacy filter holds regardless of what the model passes at call time. Prefer sdk.fetch(...) as the default integration; reach for as_tool only when the LLM genuinely needs agency over when context is fetched mid-reasoning.
Parameters
Which scope the tool fetches from. One of
"conversation", "user", "customer", "client", or "unified" (cross-scope). Defaults to "user".Closed-over user identifier. Required when
scope="user", and strongly recommended for "conversation" and "unified" so the per-user privacy filter applies.Closed-over customer identifier. Required when
scope="customer".Optional closed-over conversation identifier. When provided, the tool always fetches for this conversation; when omitted, the LLM supplies it per call.
Override the tool name exposed to the LLM. Defaults to
synap_fetch_{scope}_context.Override the tool description. Defaults to a scope-specific blurb that primes the LLM to call it for context retrieval.
Output dict shape.
"openai" returns {"type": "function", "function": {...}}; "anthropic" returns {"name", "description", "input_schema"}. Defaults to "openai".Returns
A tool definition dict shaped for the requestedstyle. The dict always carries an async handler key with the bound coroutine; host runtimes that don’t use it can ignore it.
Present in
"openai" style only. Always "function".Present in
"openai" style only. Contains name, description, and parameters (the JSON schema).Present in
"anthropic" style. The tool name.Present in
"anthropic" style. The tool description.Present in
"anthropic" style. JSON schema describing the tool’s call-time arguments.Async coroutine the host runtime should
await with the LLM’s tool-call arguments. Returns the same shape sdk.fetch(...) produces.Example
Raises
InvalidInputError— whenscopeis not one of the accepted values, whenscope="user"is requested withoutuser_id, whenscope="customer"is requested withoutcustomer_id, or whenstyleis not"openai"or"anthropic".
See also
- fetch — the recommended pre-fetch integration path.
- initialize — required before calling
as_tool’s handler.