konsulto_get_audit_context
Retrieve the active audit's context including name, status, dates, scope and asset counts, and finding severity rollup. Use at session start to orient yourself.
Instructions
One-shot orientation tool — returns the active audit's name, status, dates, scope element count, asset count, finding severity rollup, and team. Call this at session start (after whoami) to ground yourself before doing work in the audit. Defaults to the active audit; pass audit to override.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audit | No | Audit ID. Defaults to active audit. |
Implementation Reference
- src/server.ts:208-212 (registration)Tool registration — defines the name, description, optional 'audit' input schema (z.string().optional()), and wires the handler.
server.tool( 'konsulto_get_audit_context', 'One-shot orientation tool — returns the active audit\'s name, status, ' + 'dates, scope element count, asset count, finding severity rollup, and ' + 'team. Call this at session start (after whoami) to ground yourself ' + - src/server.ts:218-243 (handler)Handler — resolves audit ID via state.resolveAuditId, fetches audit from /audits/{id}, returns name, status, dates, severitySummary, scopeCount, assetCount, teamMembers, tags, and webUrl.
async ({ audit }) => { try { const auditId = state.resolveAuditId(audit); const a = (await client.get<any>(`/audits/${auditId}`)) as any; return ok({ audit: { id: String(a._id ?? a.id), name: a.name, status: a.status, startDate: a.startDate, endDate: a.endDate, description: a.description, severitySummary: a.severitySummary ?? null, maxSeverityOpen: a.maxSeverityOpen ?? null, scopeCount: Array.isArray(a.scopes) ? a.scopes.length : 0, assetCount: Array.isArray(a.assets) ? a.assets.length : 0, teamMembers: Array.isArray(a.teamMembers) ? a.teamMembers : [], tags: a.tags ?? [], }, webUrl: client.webUrl(`/audits/${a._id ?? a.id}`), }); } catch (err) { return errResult(err); } }, ); - src/server.ts:215-217 (schema)Input schema — accepts single optional string parameter 'audit' with Zod validation. No output schema defined beyond the inline return shape.
{ audit: z.string().optional().describe('Audit ID. Defaults to active audit.'), }, - src/context/session-state.ts:29-41 (helper)SessionState.resolveAuditId — helper used by the handler to resolve the audit ID from an optional override or the active audit, throwing a clear error if neither is available.
// Convenience used by tools that take an optional audit override — // returns the resolved audit ID with a clear error path when neither // an explicit override nor an active audit is set. The thrown message // is agent-actionable. resolveAuditId(override?: string): string { if (override && override.trim()) return override.trim(); if (this.activeAudit) return this.activeAudit.id; throw new Error( 'No active audit. Either pass an explicit "audit" argument, ' + 'call konsulto_set_active_audit({audit: "<name or id>"}) first, ' + 'or run from a folder with a .konsulto.yml that pins an audit.', ); }