Skip to main content
Glama

audit_context_health

Audit raw logs, code, or prompts for token bloat, framework noise, and credential leaks. Get a health grade, savings estimate, and actionable recommendations without modifying your workspace.

Instructions

Audits a raw error log, code snippet, or prompt payload for token bloat, framework noise, and credential leaks. Returns actionable M2M telemetry and savings recommendations without mutating workspace state.

• Side Effects: None. Read-only in-memory evaluation. • Auth & Permissions: None. • Rate Limits: None. • Return Shape: Returns JSON with 'raw_characters', 'estimated_raw_tokens', 'clean_characters', 'estimated_clean_tokens', 'tokens_saved', 'noise_reduction_pct', 'secrets_detected', 'health_grade' ('OPTIMAL', 'MODERATE_BLOAT', 'CRITICAL_BLOAT'), and 'recommendation'. • When to use: Call proactively when dealing with large terminal dumps or before sending long logs to the LLM to verify context efficiency. • When NOT to use: Do NOT use to apply file edits (use apply_code_patch) or query stack overflow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payloadYesRaw string, stack trace, or prompt payload to audit for token bloat and credentials.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.8

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden. It explicitly states side effects are none, it is read-only in-memory evaluation, requires no auth, has no rate limits, and details the exact return shape including fields and possible health grade values.

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 structured with bullet points and front-loads the core purpose. Each section adds distinct value: side effects, auth, rate limits, return shape, when to use, and when not to use. Nothing feels redundant.

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 one parameter, no output schema, and no annotations, the description fully compensates: it explains input expectations, return format, safety profile, and usage boundaries. An agent has everything needed to select and invoke the tool correctly.

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

Parameters3/5

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

Schema coverage is 100% and the parameter description already explains that payload is a raw string, stack trace, or prompt payload. The tool description adds mild extra context about error logs and code snippets but does not fundamentally expand parameter semantics beyond the schema.

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 clearly states the tool audits raw error logs, code snippets, or prompt payloads for token bloat, framework noise, and credential leaks. It differentiates itself from siblings by explicitly saying it does not apply file edits or query Stack Overflow.

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 guidance: proactively for large terminal dumps or before sending long logs to an LLM. It also gives clear when-not-to-use guidance, naming apply_code_patch and search_stack_overflow as alternatives.

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