Skip to main content
Glama
identity-aiops

identity-aiops

client_sessions

Read-only

Read active user sessions for one Keycloak client by client_id to audit or troubleshoot SSO activity; if unsupported on authentik, use per-user session lookup instead.

Instructions

[READ] Active user sessions on one client (Keycloak).

KEYCLOAK ONLY. authentik has no per-provider session listing, so on an authentik target this returns {"error": "Resource 'client_sessions' is not mapped for platform 'authentik'..."}. That is a platform-capability answer, not a fault: switch approach (user_sessions per user) rather than retrying or reporting the tool as broken.

Args: client_id: Internal id, from list_clients. max_results: Page bound (default 200). target: IdP target name from config; omit for the default.

Returns {"sessions": [...], "returned": N, "limit": L, "truncated": bool}, with truncated measured rather than guessed.

Input Schema

NameRequiredDescriptionDefault
targetNo
client_idYes
max_resultsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, yet the description adds substantial behavior the annotations cannot: a platform-capability failure mode with the literal error string, the instruction to treat it as an answer rather than a fault, pagination semantics, and that 'truncated' is measured rather than guessed. This goes well beyond the structured safety hint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the read marker, then the platform caveat, args, and return shape in a clear scanned order. The pseudo-signature Args/Returns block is slightly verbose for three parameters but every line carries actionable information, so waste is minimal.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description fills that gap by specifying the return object keys (sessions, returned, limit, truncated) and the meaning of 'truncated'. Combined with the platform caveat and parameter sourcing, an agent has everything needed to call and interpret this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% (properties carry only titles), so the description must compensate and does: client_id is an 'Internal id, from list_clients' (a concrete source), max_results is a 'Page bound (default 200)', and target is the 'IdP target name from config; omit for the default'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource+scope: '[READ] Active user sessions on one client (Keycloak).' It is immediately distinguishable from user_sessions (per-user) and client_session_stats (aggregates) by naming the client-scoped listing explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-not-to-use guidance: 'KEYCLOAK ONLY', spells out the exact error returned on authentik targets, and tells the agent to 'switch approach (user_sessions per user) rather than retrying or reporting the tool as broken.' That is a full when/when-not/alternative triad.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.