Skip to main content
Glama
nwjnjjj
by nwjnjjj

SmartTokenGuard

Stop paying for broken AI video renders.

SmartTokenGuard checks every keyframe and clip you generate with ComfyUI, Kling, Runway, Veo, Hailuo, Seedance or any other AI video tool. It catches the render failures you would otherwise pay to re-render later, and tells your AI assistant what to do next: pass it, retry with specific fixes, switch models, or stop spending on that shot.

Tool

What it does

stg_inspect_render

Measures an image or video: blur and soft focus, over/under-exposure, black frames, frozen segments, flicker, hard cuts, impacts and flashes, and colour/lighting drift against a reference image. Returns review frames so your assistant can check hands, faces and identity.

stg_qa_gate

Turns measured issues + what the assistant saw into PASS / RETRY_SAME_MODEL / SWITCH_TO_FALLBACK / HALT / HALT_BUDGET, with concrete fixes (negative-prompt terms, lower motion, new seed). Keeps a spend ledger per project on your computer.

stg_detect_events

Exact frames of impacts, flashes and cuts, for placing sound effects.

stg_spend_report

What a project spent, attempts per passed shot, first-try pass rate, keyframes rejected before paying for video.

stg_account, stg_pricing

License usage and plans.

Check the keyframe first. A rejected still costs nothing. A rejected 5-second clip has already been paid for.

What it does not do: it never generates or re-renders video, and never calls a paid AI API for you. Hands, faces and identity are judged by your assistant from the review frames; a render is only PASS after that visual review.

Plans

Plan

Monthly

Yearly

Checks per month

Starter

US$9

US$99

300

Pro

US$29

US$290

3,000

Checks reset on the 1st of each month (UTC). One license per person; teams buy one per member. Checkout, tax and invoices are handled by Polar, the merchant of record. The license key in your Polar receipt is your API key. Cancel or change plans in the Polar customer portal. Run stg_pricing for the checkout links.

Related MCP server: comfy-ae-video-factory-mcp

Install (MCP)

Requires uv.

Claude Desktop / Cursor: add to claude_desktop_config.json or ~/.cursor/mcp.json:

{
  "mcpServers": {
    "smart-token-guard": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/nwjnjjj/smart-token-guard", "smart-token-guard"],
      "env": { "STG_LICENSE_KEY": "your-license-key" }
    }
  }
}

Claude Code

claude mcp add smart-token-guard -e STG_LICENSE_KEY=your-license-key -- uvx --from git+https://github.com/nwjnjjj/smart-token-guard smart-token-guard

VS Code: .vscode/mcp.json{"servers": {"smart-token-guard": {"type": "stdio", "command": "uvx", "args": [...same...], "env": {...}}}}

Then ask: "Inspect renders/sh010_keyframe.png against refs/kai.png. If it passes, I'll render the clip on Kling (0.7 USD, fallback Runway)."

Python SDK

pip install git+https://github.com/nwjnjjj/smart-token-guard
from smart_token_guard import Client

stg = Client()  # reads STG_LICENSE_KEY
report = stg.inspect("renders/sh010.mp4", reference_image="refs/kai.png")
print(report["report"]["issues"], report["license"]["checks_remaining"])

decision = stg.qa_gate(model="Kling", render_cost_usd=0.7, technical_issues=report["report"]["issues"],
                       semantic_defects=["deformed_hands"], fallback_model="Runway")
print(decision["decision"], decision["actions"])

HTTP API: POST /v1/inspect (multipart file, optional reference, options JSON), POST /v1/qa-gate, GET /v1/account with Authorization: Bearer <license key>. See GET /v1/capabilities.

Limits and privacy

  • Up to 32 MB, 60 seconds and 1080p per file (JPEG, PNG, WebP, MP4, MOV, WebM, MKV). 30 requests per minute.

  • Files are uploaded to the SmartTokenGuard API (Google Cloud), analysed in a temporary file, and deleted before the response is sent. Nothing is stored and nothing is used for training.

  • The API receives your license key and the file. Project ledgers stay on your computer (~/.smart-token-guard/).

  • Measured checks catch technical render failures. They do not certify anatomy, identity, copyright or story quality.

Support

Refunds, invoices and cancellation: Polar customer portal (link in your receipt). The client code in this repository is MIT licensed; the hosted API requires a paid license.

Available Tools

6 tools
stg_accountAInspect

Check the configured license: who it is licensed to, checks used and checks remaining.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description must carry the behavioral load. It discloses that the result concerns the currently configured license and that quota-style counters (used/remaining) are returned, but says nothing about whether the call is a safe read, requires credentials, or how often the counters refresh.

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?

A single compact sentence that front-loads the purpose and then lists the returned values, with no filler. Every clause adds information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter read tool with an output schema, the return values need not be explained further, and the description adequately covers what the tool reports. The only gap is the absence of any usage or freshness context, which is minor at this complexity level.

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?

The tool takes zero parameters and the schema is empty, so there is nothing for the description to disambiguate. Baseline of 4 applies for a parameterless tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb ('Check') and resource ('the configured license') and enumerates the returned facets (licensee, checks used, checks remaining), which clearly separates it from the pricing, spend, render, and event siblings. It does not explicitly name or contrast a sibling tool, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no statement of when to call this tool versus alternatives such as stg_pricing or stg_spend_report, and no prerequisites or exclusions are mentioned. The agent must infer usage from the tool name alone.

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

stg_detect_eventsCInspect

Frames and times of impacts, flashes and cuts in a video — for placing sound effects in an editor. Uses 1 check.

ParametersJSON Schema
NameRequiredDescriptionDefault
video_pathYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.6/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. It mentions the output and a cost-like note ('Uses 1 check'), but does not disclose read-only status, permissions, rate limits, error handling, or whether the operation consumes credits in a specific way.

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?

Very short and front-loads the output description, but the first clause is a fragment and 'Uses 1 check' is unclear. It avoids bloat, yet some sentences are too cryptic to fully earn their place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The presence of an output schema means return values need not be explained, but for a single-input tool with no annotations and 0% schema description coverage, the description is missing key context: parameter format, invocation guidance, and behavioral constraints.

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

Parameters2/5

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

There is one required parameter, video_path, and schema description coverage is 0%. The description does not mention the parameter at all, so it adds no meaning beyond the schema's type and title, such as whether the path is a local file or URL.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States the output (frames and times of impacts, flashes and cuts) and the use case (placing sound effects in an editor), which is specific enough to distinguish it from unrelated siblings like stg_account and stg_pricing. The trailing 'Uses 1 check' is vague, but the core purpose is clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an intended application ('for placing sound effects in an editor') but no explicit when-to-use, when-not-to-use, or alternative tools. It does not say what kind of video input is required or whether other tools should be used first.

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

stg_inspect_renderAInspect

Measure a rendered image or video (local path, max 32 MB / 60 s / 1080p): blur, exposure, black and frozen frames, flicker, hard cuts, impacts and flashes, and colour/lighting drift against reference_image. Uses 1 check. Returns a JSON report plus review frames — look at them for anatomy/identity defects, then call stg_qa_gate.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
sensitivityNo
ignore_issuesNo
review_framesNo
reference_imageNo

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden and discloses important constraints: local path, max 32 MB / 60 s / 1080p, 'Uses 1 check', and that it returns a JSON report plus review frames. It does not discuss permissions, side effects, or rate limits, but the key operational traits are present.

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 front-loaded with purpose, constraints, and measured metrics, then closes with return behavior and next step. It is dense but each clause earns its place, though the metric list is long.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description explains the return type and how to use the returned frames. For a five-parameter tool with no annotations, it covers workflow and limits well, but it should do more to explain the optional parameters.

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

Parameters2/5

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

Schema description coverage is 0% across five parameters. The description adds meaning for the required 'path' (local file limits) and for 'reference_image' (colour/lighting drift comparison), but it leaves 'sensitivity', 'ignore_issues', and 'review_frames' unexplained beyond their bare titles.

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 uses a specific verb ('Measure') and resource ('rendered image or video'), then enumerates the exact quality dimensions it checks. It also names the follow-up tool stg_qa_gate, making the tool's role unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear workflow context: inspect the returned review frames for anatomy/identity defects, then call stg_qa_gate. It does not state when not to use the tool or name alternatives such as stg_detect_events, but the intended usage is well implied.

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

stg_pricingCInspect

Plans, prices and checkout links for SmartTokenGuard. No license needed.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. It does disclose one useful trait - no license is required to call it - but says nothing about side effects, whether it is read-only, or whether it implies any checkout/authorization action, which is a notable gap given the checkout-links wording.

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?

It is a single terse sentence, front-loaded with the useful content and free of filler. The phrasing is slightly telegraphic ('Plans, prices and checkout links') but nothing is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, return values need not be described, and with zero parameters the schema burden is nil. What remains is an adequate but thin definition: the auth note is covered, yet the nature of the operation and its role among the stg_* siblings is left implicit.

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?

The tool takes zero parameters, so the baseline of 4 applies; the schema has nothing for the description to elaborate on. No parameter-level meaning is missing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description lists what the tool surfaces (plans, prices, checkout links) which gives a reasonable sense of the resource, but offers no verb and never states the operation, so the agent must infer that this is a lookup/model-retrieval tool. No sibling overlap is apparent, but there is no explicit differentiation either.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use guidance, no mention of when another sibling (e.g. stg_account or stg_spend_report) would be the better choice, and no task context. The only usable hint is 'No license needed', which is a precondition rather than usage direction.

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

stg_qa_gateBInspect

Decide what to do with a render: PASS / NEEDS_VISUAL_REVIEW / RETRY_SAME_MODEL / SWITCH_TO_FALLBACK / HALT / HALT_BUDGET, with concrete fixes (negative-prompt terms, lower motion, new seed). technical_issues: the issues array from stg_inspect_render. semantic_defects: what you saw in the review frames ("other" + notes if unlisted). Records the attempt and its cost in a local project ledger. Free (needs a license, uses no checks).

ParametersJSON Schema
NameRequiredDescriptionDefault
modelYes
notesNo
stageNoclip
projectYes
shot_idYes
fallback_modelNo
render_cost_usdYes
semantic_defectsNo
technical_issuesNo
visually_reviewedNo
project_budget_usdNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose two meaningful traits: it records the attempt and its cost in a local project ledger (a side effect), and it is 'Free (needs a license, uses no checks)' (cost/auth profile). It stops short of describing what each disposition triggers downstream or whether the ledger write is idempotent, so the behavioral picture is partial.

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 disposition set and the required inputs are front-loaded, and the remaining sentences each carry distinct information (fix suggestions, param sourcing, ledger side effect, cost). It is dense but not padded, though the mid-paragraph param notes make it slightly run-on.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained. But for a no-annotation, 11-parameter, mutation-and-ledger tool, the description leaves most parameter meanings and the consequences of each decision branch unstated, so it is only adequately complete.

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

Parameters2/5

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

Schema description coverage is 0% across 11 parameters, so the description must compensate. It explains only two of them (technical_issues and semantic_defects, including the 'other' + notes convention), leaving project, shot_id, model, render_cost_usd, stage, fallback_model, visually_reviewed, notes, and project_budget_usd undocumented in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb and resource ('Decide what to do with a render') and enumerates the exact disposition set (PASS / NEEDS_VISUAL_REVIEW / RETRY_SAME_MODEL / SWITCH_TO_FALLBACK / HALT / HALT_BUDGET), which an agent can act on. It also ties itself to a sibling by naming stg_inspect_render as the source of `technical_issues`. Sibling differentiation against the other tools (stg_account, stg_pricing, stg_spend_report) is only implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied through the data-flow references ('the issues array from stg_inspect_render', 'what you saw in the review frames'), which suggests this runs after inspection and review. However, it never states explicitly when to invoke this gate versus the siblings, nor when not to use it, leaving the sequencing to inference.

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

stg_spend_reportCInspect

What a project spent on renders, attempts per shot, first-try pass rate and failed renders caught. Local only.

ParametersJSON Schema
NameRequiredDescriptionDefault
projectYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.8/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. 'Local only' is a useful hint that no network/external call is made, but it does not state read-only vs mutating nature, cost, permissions, or output shape, leaving the operation's behavior largely opaque.

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?

Two short phrases, front-loaded with the metric list and tailed with the locality constraint. Nothing is padded, though the final 'Local only.' fragment is slightly abrupt.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists so return values need not be explained, and the metric enumeration covers the report's contents. However, with a required parameter that is entirely undocumented and no usage routing, the definition is only minimally adequate for a single-parameter report tool.

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

Parameters2/5

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

Schema description coverage is 0% and the single 'project' parameter is undocumented in both schema and description. The description adds no information about what the parameter accepts (ID, name, path?) or its format, so it fails to compensate for the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names the specific metrics reported (render spend, attempts per shot, first-try pass rate, failed renders), which is concrete and distinguishes it from a generic spend tool. It stops short of explicitly contrasting with siblings like stg_pricing or stg_qa_gate, but the content scope is clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to reach for this versus stg_pricing, stg_inspect_render, or stg_qa_gate, and no preconditions or context are given. The agent must infer usage entirely from the metric list.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv0.1.0
    • First observedstg_account
    • First observedstg_detect_events
    • First observedstg_inspect_render
    • First observedstg_pricing
    • First observedstg_qa_gate
    • First observedstg_spend_report

TDQS

B3.4/5.0

Scored across 6 tools

Disambiguation4/5

Tools are mostly distinct by lifecycle stage: stg_account and stg_pricing cover license/commercials, stg_spend_report covers spend, stg_inspect_render measures technical quality, stg_detect_events finds edit points, and stg_qa_gate makes the final decision. stg_inspect_render and stg_detect_events both analyze video frames, but their outputs and stated uses differ clearly enough.

Naming Consistency4/5

All tools use the same stg_ prefix and snake_case casing, so the naming is predictable. Names mix verb_noun (stg_inspect_render, stg_detect_events) with noun_phrase labels (stg_account, stg_pricing), but that is a minor deviation rather than an inconsistent convention.

Tool Count5/5

Six tools are well-scoped for a render QA/guarding workflow, with each tool covering a distinct stage: account, pricing, spend, technical inspection, event detection, and final gate. The count is neither thin nor bloated.

Completeness4/5

The surface covers license status, pricing, spend tracking, technical render inspection, event detection, and a QA decision gate, which is a coherent lifecycle. Minor gaps remain around license activation/configuration and any explicit semantic-defect helper, but agents can work around these by supplying license state and semantic notes themselves.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers