Skip to main content
Glama

Read session state

niche_session_state
Read-only

Universal poll endpoint: read the full current state of a session. Returns status, ranked stories, picked story_id, generated angles, picked angle_id, draft outputs (with trust fields), and an elicitation hint for whatever decision is next. Call this whenever you need to check progress; it's safe and cheap.

Each story includes title, summary, headline_candidate (the post-shaped headline distinct from the cluster title), recency_score, relevance_score, freshness_label, and the publication_breakdown of contributing outlets (provenance). Each story also carries a recommended_story_id plus recommendation_reason before a pick. Each draft output's trust data lives under outputs[i].trust.* (verifier_blocked_reason, source_faithfulness_score, source_ungrounded_claims, source_diversity_passed, source_recency_passed, source_distinct_count, plus a flags[] array with explicit severity and source_grounding_map). The output top level does not mirror these; read them from .trust.

Response also includes phase (high-level: scanning / drafting / filed / spiked / awaiting), phase_message (a rotating gerund, e.g. 'Reading 337 signals'), and phase_hint (a one-line agent-facing tooltip with a typical timing band, e.g. 'Clustering, usually 8-15s, no action needed'). The full 17-status state machine is enumerated under status_glossary so you can introspect what every state means without discovering it experimentally. For a terminal run, read outcome (complete / expired / interrupted / cancelled / failed) rather than the raw status: a failed status is usually an expired walk-away (a slate was produced) or a refunded interruption, not a real error.

Recommended loop: kick off work, then one niche_session_state(wait:30, wait_until:'checkpoint') per stage. It sleeps through the noisy transient statuses (clustering, ranking, generating_*) and wakes only at the next actionable stop (cpN_awaiting_* / complete / failed), or when an async render settles. So a full run is one wait per checkpoint, not several wakes per stage. (wait_for is an accepted alias for wait_until.) The wait plus since_status long-poll (wait_until:'change', wakes on any status change) is also supported; prefer 'checkpoint'. Each status' actionable flag in status_glossary[] indicates which states a 'checkpoint' wait wakes for. Avoid polling every few seconds without wait, which may be rate-limited (HTTP 429).

niche_story_search is an accepted alias for this tool.

Response shape is sparse by default: after a story is picked, only the picked story is returned (not all candidates); same for angles. Set include_unpicked=true to get the full candidate set, useful when revising to a different story or angle. A sparse_mode field in the response reports how many items were dropped.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
viewNo`status` (lean): a few-hundred-byte control envelope of status, phase, picked ids, `content_versions` (per-section change counters), `counts`, `output_ids`, cost, and next_step. Use this for the poll loop. `full` (default): the complete state with stories/angles/outputs. Fetch `full` once when a content_version moves, rather than re-shipping the full state every poll. Pairs with wait plus since_status.full
waitNoLong-poll for up to N seconds (0-30) waiting for the session state to change. Returns immediately if the state already differs from `since_status` (or if the session is awaiting a checkpoint / complete / failed). Drops agent token burn from N polls to 1 wait. Default 0 (no wait, behave as before).
wait_forNoAlias for `wait_until` (same values and semantics). Use either; if both are set, `wait_until` wins. An unrecognized value is rejected (not silently ignored), and it only takes effect with `wait` > 0.
session_idYessession_id from niche_signal_scan.
wait_untilNoWhat the `wait` long-poll resolves on. `change` (default): any status change vs since_status, a reached checkpoint, or a status-less change (synthesis fill, render completion, new output). `checkpoint`: only an actionable checkpoint (cpN_awaiting_* / complete / failed), skipping the noisy intermediate cpN_generating and generating_* transitions, so you get one wake per checkpoint. `render`: a reel/image render marker settles (done|failed). Use this after niche_render_reel / niche_render_image_card, since a render leaves status unchanged and won't wake a `change` wait on status alone. Works on a session already at complete (the normal case, since renders are post-completion add-ons): the wait holds on the render marker, not the session status. `synthesis`: a niche_intelligence_query's synthesis lands (narratives or a shortfall_note). Synthesis filling is not a status change, so block on this in one call instead of busy-polling.change
since_statusNoUsed with `wait` (wait_until='change'). The status the caller last saw; the wait returns as soon as session.status differs. If unset, any state-change event wakes the wait. Note the pipeline has paired vocabulary: a transient `cpN_generating` (checkpoint about to produce) and a `generating_*` work status (e.g. cp2_generating maps to generating_angles). To skip both and wake only at the next actionable stop, use wait_until='checkpoint' rather than chasing since_status through the intermediates.
include_unpickedNoWhen true, return the full candidate set even after picks have been made. Default false (sparse: only the picked story / angle come back). Meaningful only with view='full'; ignored in view='status' (the lean envelope never carries the candidate slate).
include_status_glossaryNoWhen true, response includes `status_glossary[]`, the full 17-status state-machine descriptor list with phase, hint, and `actionable` (whether a wait_until='checkpoint' wakes for it) per status. Useful on the first call of an agent session so the agent caches the full map; leave false on subsequent polls. Default false.

TDQS

A4.8/5.0
Behavior5/5

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

Discloses numerous behavioral traits beyond the readOnly/destructive annotations: sleep-and-wake polling semantics, sparse response behavior, outcome vs. raw status nuance ('a failed status is usually an expired walk-away'), alias behavior, and rate-limit risk (HTTP 429). Annotations already mark readOnlyHint=true and destructiveHint=false, so the description adds rich context rather than repeating safe-read facts.

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?

The description is long but exceptionally dense and well-organized: front-loaded purpose, then return fields, then polling guidance, then sparsity and edge cases. Each section earns its keep; there is no filler or repetition. It could arguably be tightened, but the structured paragraphs and clear topical separation make it easy to scan despite the length.

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?

Given the tool's complexity (8 params, 17-status state machine, no output schema), the description covers everything an agent needs: response fields, trust data location, status_glossary, outcome semantics, aliases, rate limits, sparse mode, and recommended loop. It fully compensates for the missing output schema and leaves no obvious gap.

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

Parameters4/5

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

Input schema already covers all 8 parameters with full descriptions, defaults, and enums (100% coverage). The description elevates this by explaining how parameters interact operationally—e.g., wait_until='checkpoint' vs 'change', wait_for alias precedence, include_unpicked sparsity semantics, and recommended concrete values (wait=30). The baseline for 100% coverage is 3, but the added operational context justifies a 4.

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 'Universal poll endpoint: read the full current state of a session' and enumerates exact return fields (status, ranked stories, picked IDs, draft outputs, trust fields, elicitation hint). This specific verb+resource scope clearly distinguishes it from siblings like niche_signal_scan (kickoff) and niche_list_sessions (session list).

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?

Provides explicit when-to-use and how-to-use guidance: 'Call this whenever you need to check progress; it's safe and cheap' and recommends a polling loop with wait=30 and wait_until='checkpoint'. It also warns against rapid polling ('Avoid polling every few seconds without wait, which may be rate-limited') and explains when to use wait_until='render' or 'synthesis' for sibling render/query tools, effectively defining alternatives.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.2/5.0
Disambiguation4/5

Tools are mostly distinct across the pipeline—discovery, brand setup, drafting, rendering, publishing, session management—and descriptions are detailed. Minor overlap exists between niche_signal_scan and niche_intelligence_query (both discovery) and between niche_add_output and niche_draft_create (both generate outputs), but the descriptions clearly differentiate them. Overall, an agent can reliably select the right tool.

Naming Consistency3/5

All tools share the `niche_` prefix and snake_case, but the verb/noun order is inconsistent: some are verb-first (add_output, render_image_card, list_sessions) while many are noun-first (angle_propose, brand_kit_ingest, draft_create, session_cancel). This mixed convention requires the agent to learn each name individually rather than predict the pattern.

Tool Count3/5

25 tools is on the heavy side but appropriate for the platform's scope—full editorial intelligence from discovery to publish. No redundant tools, and each covers a distinct aspect, but the count is high enough that it feels dense and may require orientation (which niche_whoami addresses).

Completeness4/5

The toolset covers the full workflow: discovery, angle proposal, drafting, revision, publishing, rendering, asset attachment, brand setup, and session management. Minor gaps exist, such as no direct read tool for the current BrandKit (only via ingest status) and no hard-delete tool (session_cancel mentions the REST endpoint instead), but these are edge cases and agents can work around them.