Skip to main content
Glama

Persistent Project Context for xAI Grok

Estimate tokens

faf_estimate_tokens
Read-onlyIdempotent

Estimate token count for arbitrary content via the Zig WASM engine. Sub-millisecond, zero allocations. Useful for context-budget planning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesContent to estimate tokens for.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "content": {
      -      "items": {
      -        "properties": {
      -          "text": {
      -            "description": "Human-readable tool result.",
      -            "type": "string"
      -          },
      -          "type": {
      -            "const": "text",
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "type",
      -          "text"
      -        ],
      -        "type": "object"
      -      },
      -      "type": "array"
      -    },
      -    "isError": {
      -      "description": "True when the tool failed.",
      -      "type": "boolean"
      -    }
      -  },
      -  "required": [
      -    "content",
      -    "isError"
      -  ],
      -  "type": "object"
      -}New value: +null
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "content": {
      +      "items": {
      +        "properties": {
      +          "text": {
      +            "description": "Human-readable tool result.",
      +            "type": "string"
      +          },
      +          "type": {
      +            "const": "text",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type",
      +          "text"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "isError": {
      +      "description": "True when the tool failed.",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "content",
      +    "isError"
      +  ],
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already convey read-only, idempotent, non-destructive behavior. The description adds meaningful extra context: sub-millisecond execution, zero allocations, and the underlying engine. This goes beyond the structured annotations and helps the agent anticipate performance characteristics.

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?

Two sentences earn their place: the first states the action and object, the second adds unique behavioral and use-case context. There is no filler, and the most important information appears immediately.

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?

The tool is a simple single-parameter estimator, and the description covers its purpose, scope, performance, and use case. The output shape is not explicitly stated, but 'token count' strongly implies the return type. This is only a minor gap, so it is not a 5.

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?

The schema covers the single parameter with full clarity: 'Content to estimate tokens for.' The description reinforces this with 'arbitrary content' but does not add new parameter-level semantics. With 100% schema coverage, the baseline score is appropriate.

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 a specific verb and resource: 'Estimate token count for arbitrary content.' This clearly distinguishes it from sibling tools like faf_analyze and faf_collections_search, which imply different operations. The mention of the Zig WASM engine further grounds the tool's identity.

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?

The phrase 'Useful for context-budget planning' gives the agent a clear reason to select this tool. It does not explicitly call out alternative tools or exclusions, but the focused scope plus the sibling context is sufficient for most cases.

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.