summaryrefslogtreecommitdiff
path: root/src/mcp/tools/get_system_health.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mcp/tools/get_system_health.c')
-rw-r--r--src/mcp/tools/get_system_health.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mcp/tools/get_system_health.c b/src/mcp/tools/get_system_health.c
index 893a3b1..4189db3 100644
--- a/src/mcp/tools/get_system_health.c
+++ b/src/mcp/tools/get_system_health.c
@@ -15,6 +15,11 @@ call_get_system_health(const mcpc_tool_t *tool, mcpc_ucbr_t *result)
tiny_mcp_tool_add_error(result, "INTERNAL_ERROR", "tool context is unavailable");
return;
}
+ if (!tiny_mcp_tools_ensure_history_index(context) || !context->history_index)
+ {
+ tiny_mcp_tool_add_error(result, "INTERNAL_ERROR", "history index allocation failed");
+ return;
+ }
tiny_store_health(context->store, &health);
tiny_json_init(&json);
tiny_json_raw(&json, "{\"status\":");
@@ -27,6 +32,8 @@ call_get_system_health(const mcpc_tool_t *tool, mcpc_ucbr_t *result)
tiny_json_u64(&json, health.snapshot_size);
tiny_json_raw(&json, ",\"active_messages\":");
tiny_json_u64(&json, health.active_messages);
+ tiny_json_raw(&json, ",\"session_count\":");
+ tiny_json_u64(&json, tiny_history_index_session_count(context->history_index));
tiny_json_raw(&json, ",\"deleted_messages\":");
tiny_json_u64(&json, health.deleted_messages);
tiny_json_raw(&json, ",\"last_sequence\":");