get_trigger_memory
Retrieve psychological trigger profiles distinguishing active stress triggers from resolved topics to guide sensitive conversation navigation based on historical stress patterns.
Instructions
Retrieve psychological trigger profile for a subject.
Returns which conversation topics consistently cause stress (active triggers) and which have been resolved over time.
- active triggers: topics where stress was elevated across multiple sessions. Tread carefully.
- resolved triggers: topics where stress has decreased. Safe to explore deeper.
Each trigger includes observation_count, avg_score, peak_score, and last_seen.
Requires prior ingest calls with the same subject_id. Not a medical device.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subject_id | Yes |
Implementation Reference
- proxy.py:147-169 (handler)The main handler function for 'get_trigger_memory' tool. Retrieves psychological trigger profile for a subject from the Nefesh API. Decorated with @mcp.tool() for registration. Makes HTTP GET request to /v1/triggers endpoint and returns JSON response with active and resolved triggers.
# ── Tool: get_trigger_memory ──────────────────────────────────── @mcp.tool() async def get_trigger_memory(subject_id: str) -> dict: """Retrieve psychological trigger profile for a subject. Returns which conversation topics consistently cause stress (active triggers) and which have been resolved over time. - active triggers: topics where stress was elevated across multiple sessions. Tread carefully. - resolved triggers: topics where stress has decreased. Safe to explore deeper. Each trigger includes observation_count, avg_score, peak_score, and last_seen. Requires prior ingest calls with the same subject_id. Not a medical device. """ async with httpx.AsyncClient(timeout=10) as client: resp = await client.get( f"{API_URL}/v1/triggers", params={"subject_id": subject_id}, headers=_headers(), ) if resp.status_code == 200: return resp.json() return {"error": f"No trigger data found for subject {subject_id}."} - proxy.py:148-148 (registration)The @mcp.tool() decorator registers the get_trigger_memory function with the FastMCP server, making it available as an MCP tool.
@mcp.tool() - proxy.py:147-160 (schema)The schema is defined inline via the function signature (subject_id: str) -> dict and the docstring which serves as the tool description for the MCP protocol. The docstring documents the input parameter, return structure (active triggers, resolved triggers with observation_count, avg_score, peak_score, last_seen), and usage notes.
# ── Tool: get_trigger_memory ──────────────────────────────────── @mcp.tool() async def get_trigger_memory(subject_id: str) -> dict: """Retrieve psychological trigger profile for a subject. Returns which conversation topics consistently cause stress (active triggers) and which have been resolved over time. - active triggers: topics where stress was elevated across multiple sessions. Tread carefully. - resolved triggers: topics where stress has decreased. Safe to explore deeper. Each trigger includes observation_count, avg_score, peak_score, and last_seen. Requires prior ingest calls with the same subject_id. Not a medical device. """