Skip to main content
Glama

Close period

close-period
Destructive

Close a fiscal period: post its drafts, lock it, and save its statements.

WHEN TO USE:

  • Month-end: the step that posts a period's drafts and locks the period

WHAT IT DOES (atomic):

  1. Validates closeable gates (sequence, period complete, sync current)

  2. Bulk-transitions all draft entries in the period to status='posted' (under a 'shadow' QuickBooks connection: to 'shadowed' instead — nothing posts or publishes, and the gates that would have blocked are returned as gate_findings rather than enforced)

  3. Validates the BS equation balances for the period

  4. Transitions the FiscalPeriod from open → closed

  5. Advances closed_through; auto-advances close_target if reached

  6. Pivots the posted ledger and stamps the period's canonical statement FactSets (balance sheet / income statement / cash flow) — closing IS the act that persists the month's statements. Re-closing replaces them. Soft-skipped (statements_stamped=false with a note) when the tenant has no CoA mapping yet.

  7. Auto-runs the rule engine for every schedule Structure with facts in the closed period, and the statement rule corpus against the stamped sets. Rule outcomes ride on the response as rule_summary / evaluated_structure_ids / statement_rule_summary, per schedule and statement.

  8. Emits a period_closed audit event

PARAMETERS:

  • period (required): YYYY-MM format (e.g., "2026-03")

  • entity_id (optional): the entity whose period to close; omit for the group parent. Each entity closes on its own calendar, so a subsidiary's close leaves its siblings open

  • allow_stale_sync (optional): lifts the sync-current gate, closing on QuickBooks data older than the freshness window.

  • allow_stranded_obligations (optional): lifts the stranded-obligation gate, closing without adjusting entries for matured classified obligations that have none drafted. promote-obligations (dispatch_handlers=true) drafts them.

  • allow_reconciling_items (optional): lifts the reconciling-item gate, closing with posted events still flagged as changed in the source system. resolve-reconciling-item settles each one.

  • allow_unposted_source_events (optional): lifts the unposted-source-event gate, closing without bank-feed lines or QuickBooks transactions dated in the period that were never committed; they stay out of the period.

  • allow_unreconciled_accounts (optional): lifts the reconciliation gate, closing although a reconciliation the close waits on is not reconciled for the period. refresh-reconciliations reports what does not tie.

  • allow_unexplained_residuals (optional): on the consolidation entity, lifts the group close's residual gate; each difference stays in the consolidated statements and is named in the audit note.

  • allow_held_bank_lines (optional): lifts the held-bank-line gate, closing although bank lines a sync held out of an earlier closed month are undecided; each is recorded as decided by this close and none posts.

RETURNS: Two shapes. Usually the receipt below, returned once the close lands. If the close is still running when this call's budget runs out, you instead get status: "in_progress" with an operation_id and worker_started (see NOTES). That is not a failure and not a timeout: the close is running on the worker and is atomic.

The receipt:

  • period: the period that was closed

  • entries_posted: TOTAL drafts transitioned to posted, across both post paths; entries_published_to_qb / entries_posted_locally carry the split (drafts published to QuickBooks are promoted at publish time, before the local bulk transition)

  • target_auto_advanced: true if close_target moved forward after this close

  • fiscal_calendar: updated calendar state (same shape as get-fiscal-calendar)

  • rule_summary: aggregated rule-eval tally across every schedule Structure with facts in the closed period — keys: pass / fail / error / skipped. null when no schedules had facts in the period.

  • evaluated_structure_ids: ids of schedule Structures whose rules were evaluated. Pairs with rule_summary.

  • statements_stamped / statement_stamp_note: whether the close stamped the period's canonical statement FactSets (note carries the soft-skip reason, e.g. no_coa_mapping).

  • stamped_statement_sets: structure_id -> fact_set_id for the minted canonical sets; get-information-block renders them.

  • statement_rule_summary: verification tally across the stamped statements (pass / fail / error / skipped); null when no rules exist.

GATES (a 422 error names the gate):

  • the period is out of sequence

  • the period is the current, still-open month

  • the QuickBooks sync is stale (lifted by allow_stale_sync)

  • stranded obligations: matured and classified, with no drafted entry (lifted by allow_stranded_obligations)

  • unresolved reconciling items: posted events whose source payload changed afterwards (lifted by allow_reconciling_items)

  • source events dated in the period that were never committed: inbox lines, QuickBooks transactions whose automatic posting failed (lifted by allow_unposted_source_events)

  • a reconciliation the close waits on is not reconciled for the period, or was never compared for it (lifted by allow_unreconciled_accounts)

  • bank lines a sync held out of an earlier closed month, undecided (lifted by allow_held_bank_lines)

  • on the consolidation entity, the group close: every entity the month consolidates closed it; its consolidating entries posted or drafted; no residual or intercompany disagreement left (lifted by allow_unexplained_residuals); the consolidated statements pass

  • the balance sheet equation does not balance for the period

NOTES:

  • The close is dispatched to the worker and this call waits ~18s for it. An in_progress response means it is running; get-period-close-status shows period_status closed and a filled close_receipt once it lands, and get-fiscal-calendar shows has_close_receipt on the period row. worker_started: false means it is queued behind a busy worker. A repeat call within 30s returns the same operation (deduplicated: true).

  • Posted entries cannot be re-drafted; reopen-period undoes a close

  • Manual entries (drafted via create-event-block event_type='journal_entry_recorded') are posted alongside schedule drafts

  • Which drafts write back to QuickBooks follows the event's source (schedule/manual publish; system posts locally), unless metadata.publish_to_source overrides it per entry. list-period-drafts previews the split

  • After close, close_target auto-advances to the next period

  • The close runs on the worker, so a slow QuickBooks publish can outlast this call. The work is unaffected by that — only who is waiting for it

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "period": "<period>"
    },
    "name": "close-period"
  }
}

Input Schema

NameRequiredDescriptionDefault
noteNoOptional note captured in the audit event
periodYesFiscal period in YYYY-MM format
entity_idNoThe entity whose books this acts on, by id (get-graph-info lists them). Omit for the group parent.
allow_stale_syncNoLift the sync-current gate (default false), closing on QuickBooks data older than the freshness window.
allow_held_bank_linesNoOverride the held-bank-line gate (default false). Closes although bank lines a sync held out of an earlier closed month are undecided; each is recorded as decided and none posts. Prefer reopening the month they are dated in.
allow_reconciling_itemsNoOverride the reconciling-item gate (default false). Closes over posted events still flagged as changed in the source system, leaving those differences undecided; the override is recorded in the close audit note.
allow_stranded_obligationsNoOverride the stranded-obligation gate (default false). Closes over matured classified obligations that have no drafted closing entry, knowingly omitting them; the override is recorded in the close audit note.
allow_unexplained_residualsNoOn the consolidation entity, close the group month although a residual or intercompany disagreement is left unexplained.
allow_unreconciled_accountsNoOverride the reconciliation gate (default false). Closes although a reconciliation the close waits on is not reconciled for the period; the override is recorded in the close audit note.
allow_unposted_source_eventsNoOverride the unposted-source-event gate (default false). Closes over source events dated in the period that were never committed, leaving them out of the period; the override is recorded in the close audit note.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare destructive=true, readOnly=false, idempotent=false, openWorld=true; the description goes well beyond by enumerating the eight atomic steps, the soft-skip path (statements_stamped=false when no CoA mapping), the shadow-connection no-publish mode, the 422 gate taxonomy, and the worker/dedup semantics (30s window, worker_started=false means queued). The only minor tension is that idempotentHint=false sits alongside a 30s dedup guarantee, but that is a transient window rather than a contradiction, and re-closing replacing statements is consistent with non-idempotent.

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

Conciseness3/5

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

Front-loading is strong (purpose, then WHEN TO USE, then atomic steps), and headers make the long text navigable. However, the gate list is effectively stated three times — in step 1, in the GATES section, and again in the allow_* parameter bullets — and the worker/dispatch behavior is repeated in both RETURNS and NOTES. Given a destructive 10-parameter tool, length is defensible, but the redundancy costs it a point.

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?

There is no output schema, and the description compensates fully: it documents both return shapes (receipt vs. in_progress with operation_id), every receipt field, and the null conditions for rule_summary and statement_rule_summary. Combined with the full gate taxonomy and the failure/retry semantics, an agent has everything needed to call this correctly and interpret the result.

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?

Schema coverage is 100%, so baseline is 3; the PARAMETERS block earns above baseline by explaining consequences the schema does not, e.g. that each entity closes on its own calendar so a subsidiary's close leaves siblings open, and by pairing each allow_* override with the sibling that remediates the underlying condition (promote-obligations, resolve-reconciling-item, refresh-reconciliations). It does not add format details for period beyond the schema's YYYY-MM, but that is already fully specified.

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 and resource plus a three-part scope: "Close a fiscal period: post its drafts, lock it, and save its statements." That framing distinguishes it from reopen-period and get-period-close-status without the agent needing to open any schema.

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?

A dedicated WHEN TO USE section names the month-end scenario, and NOTES routes the agent to explicit alternatives: get-period-close-status for polling, list-period-drafts to preview the publish split, reopen-period to undo. It also warns that posted entries cannot be re-drafted, which tells the agent when not to call it casually.

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.