Build focused Pi session context
pi_session_contextExtracts deterministic lexical context from a session transcript to answer a specific question, using conversation history by default without calling another LLM.
Instructions
Return deterministic lexical context for a question. Defaults to useful conversation content and does not call another LLM.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"session_ref": "<session_ref>",
"question": "<question>"
},
"name": "pi_session_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Use conversation for visible user/assistant history (default); use raw only when internal records are explicitly required. | conversation |
| question | Yes | Question used to select focused historical context, from 1 to 4000 characters. | |
| max_chars | No | Maximum Unicode characters to return, from 1 to 100000. | |
| session_ref | Yes | Opaque session_ref returned by pi_session_search or pi_session_find; reuse it unchanged. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| text | Yes | ||
| question | Yes | ||
| retrieval | Yes | ||
| session_ref | Yes | ||
| view_entries | Yes | ||
| total_entries | Yes |