Skip to main content
Glama

detect_current

Return the current runtime identity by reading environment variables and session flag files, yielding the active agent session, its model, and a resume command.

Instructions

Return the current runtime identity (session + agent) from env/fs.

NOT a session-query — this reads the runtime environment (env vars + per-session flag files), reusing the exact cascade behind the ai-r detect-agent / ai-r detect-session CLI subcommands.

Args: agent: Optional hint (accepted for symmetry with the CLI's deprecated --agent flag); the cascade scans all agents.

Returns: {"session_id", "agent", "model", "resume_command", "candidates": [...], "verified", "self"} where session_id / agent describe the highest-priority candidate, model is the current session's model — the LAST assistant model recorded in its transcript (null when identity is incomplete or the format records no model signal — never guessed) — resume_command is the ready-to-run shell one-liner that reopens the detected session in its agent's CLI (F2.2, text only, never executed; null when no real command exists) — and candidates is the full cascade for disambiguation. Returns {"error": ..., "message": ...} on an unknown agent hint.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, the description carries full burden and does so thoroughly. It explains the data sources (env vars + flag files), the candidate cascade, and the 'never guessed' behavior for model, and clarifies that resume_command is text-only and never executed. It also discloses error behavior for unknown agent hints.

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

Conciseness5/5

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

The description is well-structured with Args and Returns sections. Every sentence contributes: it defines the tool, contrasts with session queries, explains the parameter, enumerates return fields, and documents error cases. There is no filler or redundancy.

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?

Despite having an output schema, the description independently lists every return field and their semantics, including null cases and the error response. It gives enough context for the agent to invoke the tool correctly and interpret results without further lookup.

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%, but the description fully explains the single 'agent' parameter: it's an optional hint, accepted for symmetry with a deprecated CLI flag, and the cascade scans all agents. This adds meaning beyond the bare schema and leaves no ambiguity.

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?

The description opens with a specific verb+resource: 'Return the current runtime identity (session + agent) from env/fs.' It clearly distinguishes itself by stating 'NOT a session-query,' which differentiates it from sibling tools like list_sessions and read_session.

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?

It explicitly states when not to use it ('NOT a session-query') and clarifies the underlying mechanism ('reads the runtime environment (env vars + per-session flag files)'), which tells the agent this is for runtime detection rather than persistent session queries. It also references CLI subcommands, aiding alignment with existing patterns.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pro-target/ai-r'

If you have feedback or need assistance with the MCP directory API, please join our Discord server