Skip to main content
Glama
mxchris18
by mxchris18

chunk_file

Upload a local file, split its content into RAG-ready text chunks, and get structured JSON output. Supports PDF, MD, TXT, YAML, JSON up to 50 MB.

Instructions

Upload a local file, chunk its content into RAG-ready text segments, and return the structured chunks as JSON. No embedding or vector DB required.

Supported file formats: .pdf, .md, .txt, .yaml, .yml, .json Maximum file size: 50 MB

Use this when the user says 'chunk this PDF', 'process this document', 'read this file', or wants to extract text from a local file.

Provide the ABSOLUTE path to the file on the user's local machine (e.g. 'C:/Users/user/Documents/report.pdf' or '/home/user/docs/manual.pdf').

If contextual_retrieval=true is requested, follow the PRE-FLIGHT sequence:

  1. Call verify_provider_key(provider, 'llm') → get live model list

  2. Ask user to choose a model

  3. Present Contextual Retrieval as a recommended upgrade

LLM keys can be omitted if set as environment variables.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
overlapNoToken overlap between consecutive chunks. Default: 50.
file_pathYesAbsolute path to the local file to chunk. Supported: .pdf, .md, .txt, .yaml, .yml, .json. Example: 'C:/Users/user/Documents/report.pdf'
llm_modelNoLLM model name from verify_provider_key. Do not guess or hardcode.
chunk_sizeNoTarget token count per chunk. Default: 512. Range: 64–4096.
llm_api_keyNoAPI key for the LLM provider. Can be omitted if set as env var.
llm_providerNoLLM provider for contextual retrieval. Verify with verify_provider_key first.
contextual_retrievalNoEnable RAG 2.0 contextual enrichment. Present as a recommended upgrade. Requires llm_provider and llm_model from verify_provider_key.
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses file format support, size limit, absolute path requirement, and the optional contextual retrieval workflow. Lacks details on error handling or file disposal, but adequate for typical use.

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?

Well-structured with bullet points and ordered sections. Every sentence adds value. Slightly lengthy due to detailed pre-flight sequence, but still efficient.

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?

Covers input requirements, supported formats, size limit, and optional features. Does not detail return structure or error cases, but the tool's output is implied. Overall sufficient for agent invocation.

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?

Schema coverage is 100%, but description adds value by explaining absolute path, env var fallback for llm_api_key, and the verify_provider_key dependency for contextual_retrieval parameters.

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 action (upload, chunk) and resource (local file) and distinguishes from siblings like 'ingest_file' and 'autorag' by specifying it returns RAG-ready chunks without embedding or vector DB.

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?

Provides explicit trigger phrases ('chunk this PDF', 'process this document') and a detailed pre-flight sequence for contextual retrieval. Lacks explicit exclusion cases but gives clear usage context.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mxchris18/scrapedatshi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server