Skip to main content
Glama

Kleap

Write Files Directly

write_files
Destructive

Write WHOLE files DIRECTLY — YOUR model generates the code, Kleap stores, builds and deploys it as-is. To change something in a file that ALREADY EXISTS, use edit_files instead (read_files → edit_files): it replaces just the lines you name, while write_files makes you retype the entire file and silently drops whatever you leave out — on a 30KB shared layout that is how headers and footers get wiped. No Kleap-AI step, so what ships is byte-for-byte what you wrote — the right choice when a phrase, a URL or a schema must be exact. Publishing still audits the result (see publish_app). Best for scaffolding exact pages/components — e.g. programmatic-SEO routes. Astro paths (src/pages/.astro, src/data/.json, src/components/.astro, public/). Overwrites by path. NPM PACKAGES: do not write package.json (the build replaces it) — the build installs whatever your code IMPORTS, so import { jsPDF } from "jspdf"; is all it takes. Supported on import: @tiptap/, jspdf, pdf-lib, html2canvas, papaparse, file-saver, jszip, @ffmpeg/, howler, wavesurfer.js, browser-image-compression, react-dropzone, recharts, chart.js, d3, @tanstack/, react-hook-form, three, @react-three/, leaflet, maplibre-gl, gsap, framer-motion, zustand, date-fns, react-markdown, axios, socket.io-client, radix-ui/, next-themes, lucide-react, @tabler/, openai, @ai-sdk/*; anything else is refused at build with a message naming it. A client-side router is never the answer — a route is a FILE (src/pages/about.astro → /about). IMAGES AND BINARIES: set encoding:"base64" on the file and send the bytes — that is how you put a logo, a photo, an OG image, a favicon or a font on the site (png/jpg/webp/svg/ico/mp4/woff2/pdf, 512KB max each decoded). Without it you can only write text, and a site with no images looks unfinished. To ADD an image from a text prompt WITHOUT sending any bytes (a real photo's base64 is too big to emit reliably), use generate_image — Kleap generates it and stores it for you. To REMOVE a page or asset, use delete_files — overwriting it with empty content leaves a URL that answers 200 with nothing, which is worse than a 404. DATA & ACCOUNTS: write_files only STORES files — it cannot provision the Kleap Database, so DB or auth code pushed here has no backend and silently does nothing. Stand the feature up with modify_app first, then edit those pages here. After writing, call publish_app to build & go live.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesFiles to write/overwrite: [{ path, content, encoding? }]
app_idYesThe app ID
contextYesWhy this call, in one short sentence. Used to improve the connector; never include credentials or personal data.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsNo
app_idNo
binaryNo
writtenNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Goes far beyond the destructiveHint annotation by disclosing that omitted content is silently dropped (wiping headers/footers on large layouts), that output is byte-for-byte without a Kleap-AI step, that overwrites occur by path, and that DB/auth code pushed here silently does nothing without modify_app. This level of disclosure prevents serious misuse.

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 long but well-structured with clear sections (NPM PACKAGES, IMAGES AND BINARIES, DATA & ACCOUNTS) and front-loads the core purpose. Each sentence adds value, though it could be tightened without losing essential details.

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?

Comprehensive for a complex tool: covers alternatives, silent-drop pitfalls, binary handling, package restrictions, the need for modify_app for DB/auth, and the workflow of calling publish_app afterward. With an output schema present, nothing essential for correct invocation is missing.

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

Parameters5/5

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

Even though schema coverage is 100%, the description adds critical semantics: explains encoding:"base64" for binaries with a 512KB limit, warns not to write package.json because the build replaces it, and details supported npm packages, directly enriching the files parameter's meaning 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 opens with 'Write WHOLE files DIRECTLY' and immediately contrasts with edit_files for modifying existing files and delete_files for removal, making the tool's specific purpose and its distinction from siblings unmistakable.

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?

Explicitly states 'Best for scaffolding exact pages/components' and provides clear when-not-to-use guidance by naming edit_files, delete_files, generate_image, and modify_app as alternatives for specific scenarios (modifying existing files, removing pages, adding prompt-based images, provisioning databases).

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.

Resources