Skip to main content
Glama

compress_document_tool

Convert PDF and DOCX files into compressed Markdown by removing visual bloat and repeated headers, saving up to 80% tokens for LLM context windows.

Instructions

    [Cost: $0.0030 USDC on Base & Solana] Extracts and compresses PDF and DOCX documents into token-optimized Markdown.
    Strips visual bloat and repetitive headers/footers to save up to 80% tokens for LLM context windows.

    Args:
        url: HTTP/HTTPS URL of the PDF or DOCX file to download and compress.
        base64_data: Optional base64-encoded binary content of the document.
        filename: Optional filename to assist with format detection (e.g. 'paper.pdf').
        payment_signature: Optional x402 Base/Solana USDC transaction hash or developer mock key.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNo
filenameNo
base64_dataNo
payment_signatureNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It does disclose the cost, the payment requirement (payment_signature), and the transformation behavior (stripping headers/footers, token savings). However, it does not mention failure modes, rate limits, or what happens with invalid inputs or when both url and base64_data are provided.

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 well-structured: it leads with cost, then states purpose, then provides a bulleted Args list. Each sentence earns its place, and the information is front-loaded. While somewhat long, it is not verbose or redundant.

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 the tool's complexity (payment, binary input, compression) and the absence of annotations, the description covers the essential inputs, cost, payment signature, and output format. It does not detail error handling or how to obtain a payment_signature, but the presence of an output schema reduces the need to explain return values. Overall, it is fairly complete for an agent to invoke.

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 schema has 0% description coverage, so the description's Args section fully compensates by explaining each parameter's purpose, format, and optionality (e.g., 'HTTP/HTTPS URL', 'Optional base64-encoded binary content'). It does not clarify whether url or base64_data is required or how they interact, but it adds substantial meaning beyond the bare schema.

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 clearly states the verb 'extracts and compresses' with the resource 'PDF and DOCX documents' and the output 'token-optimized Markdown.' It also highlights the benefit of stripping visual bloat. However, it does not explicitly differentiate from sibling tools like extract_web_markdown or trim_llm_context, relying on the reader to infer uniqueness.

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?

The description implies usage for reducing token consumption in LLM contexts via the 80% savings claim, but it does not explicitly state when to use this tool versus alternatives or when not to use it. There are no exclusions or conditions, so guidance is implicit rather than explicit.

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