<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[KontrCAD]]></title><description><![CDATA[KontrCAD]]></description><link>https://kontrcad.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 22:15:25 GMT</lastBuildDate><atom:link href="https://kontrcad.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[90 MCP tools: what I got wrong]]></title><description><![CDATA[A week ago I wrote about giving my browser CAD an MCP server. The short version: KontrCAD keeps a project as a list of operations, so an assistant that can…]]></description><link>https://kontrcad.hashnode.dev/90-mcp-tools-what-i-got-wrong</link><guid isPermaLink="true">https://kontrcad.hashnode.dev/90-mcp-tools-what-i-got-wrong</guid><category><![CDATA[AI]]></category><category><![CDATA[mcp]]></category><category><![CDATA[cad]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Valery Lunev]]></dc:creator><pubDate>Fri, 04 Dec 2026 06:40:52 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/yh1gz7edz777ictaugp4.png" alt="The four-view render with edge lines" /></p>
<p>A week ago I wrote about giving my browser CAD an MCP server. The short version: KontrCAD keeps a project as a list of operations, so an assistant that can call <code>create_primitive</code>, <code>extrude</code> or <code>boolean_subtract</code> builds the same parametric model a human would — and you can still edit every number afterwards.</p>
<p>That article was about architecture. This one is about the boring part everybody hits around tool forty: <strong>how to stop drowning in your own tool list.</strong></p>
<p>The server now exposes 90 tools. Here is what I got wrong on the way, and what fixed it.</p>
<h2>Mistake 1: sending every schema on every request</h2>
<p>First version: all tools, all schemas, every turn. That is roughly 15k tokens of JSON describing tools the model will not touch — paid on every message, and worse, it makes the model worse at picking. Too many similar names, and it starts inventing combinations.</p>
<p>The fix was groups. Nine of them, plus three meta-tools, and a rule: the session starts with <code>core</code> only — 15 tools — and the assistant opens what it needs with <code>enable_tool_group</code>.</p>
<p>The interesting part is not the grouping but <strong>who decides</strong>. I tried making the client pre-select groups and it was always wrong. Letting the model call <code>list_tool_groups</code> and then <code>enable_tool_group</code> works better, because the model knows what it is about to do.</p>
<h2>Mistake 2: making the model verify its own work</h2>
<p>For a while the loop looked like: create a box → call a "measure" tool → compare → fix. Three calls where one should do, and the comparison was usually sloppier than the geometry.</p>
<p>Now tools accept <code>expect</code>: a bounding box and a volume the caller believes are correct. If the result is outside tolerance, the tool returns an error instead of success. The model gets the same information one call earlier, and it can't quietly skip the check.</p>
<p>This is the single change that cut the most useless turns.</p>
<h2>Mistake 3: one operation per call</h2>
<p>Boolean, then fillet, then a hole, then another fillet — four round trips, four chances to lose the thread, and if the third fails you have a half-modified scene.</p>
<p><code>batch</code> takes an array of operations and executes them in order. With <code>rollback: true</code>, a failure anywhere restores the scene to the state before the batch. The model then retries from a known-good point instead of debugging debris.</p>
<p>Batch also cuts the number of requests per turn, which matters once you hit a provider's per-minute limit.</p>
<h2>Mistake 4: instructions living in schemas</h2>
<p>Every tool description ends up wanting three paragraphs: coordinate conventions, edge IDs, what "face" means. Put them in the schema and you pay for them on every request.</p>
<p>So <code>get_help(topic)</code> returns the long version on demand. Schemas stay one line, the model fetches the page it needs, and the context bill drops by a third.</p>
<h2>Mistake 5: screenshots</h2>
<p>The assistant needs to see the result. Four viewport screenshots per iteration is four images of mostly-empty grid.</p>
<p>Instead it can request one render with four views, the part framed and cropped to its bounding box. One image, less tokens, and no need to reconstruct the shape from context.</p>
<p><img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/k75vx5cr7iduibdn5r0q.png" alt="The four-view render inside the editor" /></p>
<p>The render also draws edges on top by default. That matters more than it sounds: after a boolean, a chamfer or a thread, the silhouette barely changes, and the only way to see what actually happened is the edge lines. The model can turn them off (<code>show_edges: false</code>) when it wants a clean shape, but by default they stay on.</p>
<h2>Mistake 6: permissions as an afterthought</h2>
<p>Once the assistant could delete objects and overwrite projects, "just let it run" stopped being acceptable. Two things came out of that:</p>
<p><strong>Roles.</strong> Engineer has full access and never asks. Analyst reads the scene — dimensions, edge coordinates, degrees of freedom — and asks before changing anything. Teacher sits between: it explains and refuses to do the exercise for the student.</p>
<p><strong>Confirmations.</strong> Destructive calls from Teacher and Analyst produce a card with the tool name and arguments; the user allows or rejects. No answer in three minutes counts as a rejection.</p>
<p>The subtle part is what the model sees after a rejection. It gets a tool error that says, in effect: the user declined this, do not execute it, explain the options and offer an alternative. Not a silent <code>false</code>. Silence makes models retry, and retrying a rejected action is the fastest way to lose a user's trust.</p>
<p>Repeating the exact same call in the same turn is blocked separately — otherwise a stubborn model just tries again.</p>
<h2>Mistake 7: answering with a uuid and nothing else</h2>
<p>For a long time every tool answered "done, here is the uuid". The model then had to call <code>get_object</code> to learn where the thing actually landed — an extra round trip after every step, and a chance to drift: it remembers a position from three calls ago and confidently cuts a hole in the wrong place.</p>
<p>Since 0.9.91d the response carries the state. After any create, move, rotate or scale, objects come back with uuid, name, type, position, rotation, size, volume and bounding box.</p>
<p>Sketch calls go further: they return the actual geometry with world coordinates, not just identifiers. A constraint call returns <code>moved</code> — which elements the solver really shifted, with before, after and delta, so "I fixed the sketch" can be checked against what actually moved. And <code>add_sketch_entities</code> returns the regions it produced, so the model does not need a separate <code>get_sketch_state</code> before calling <code>extrude</code>.</p>
<p><img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/vkyrd0hjbzcip8llmwel.png" alt="The assistant inspecting the object and its edges" /></p>
<p>The model can still ask for more detail. Most of the time it does not have to, and "most of the time" is what keeps a long session from drifting.</p>
<h2>What still hurts</h2>
<p><strong>Errors are written for humans.</strong> "Edge not found" tells the model nothing it can act on. It needs the same information structured: what was expected, what was found, what to try instead. Half of my prompt hacks exist to work around unstructured errors.</p>
<p><strong>Arguments are not uniform.</strong> Some tools take uuids, some accept a name or a short prefix, some want arrays of edge objects. Every inconsistency costs a call and a paragraph of instructions.</p>
<p><strong>Rate limits are silent.</strong> GigaChat allows 25 requests per minute, and the gateway answers 502 or 504 instead of a proper 429. The retry logic has to guess whether it hit a limit or the server is down — which is exactly the kind of guessing I am trying to remove from the model.</p>
<h2>The numbers</h2>
<p><img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/ozge2db472yf55o1epea.png" alt="The M12 nut with a real thread, built by DeepSeek" /></p>
<p>An M12 nut with a real thread, built by DeepSeek through the assistant: about 200,000 tokens.</p>
<p>A fraction of a cent. The thread alone is a few dozen operations, and most of the context is cache hits — the schemas and the conversation barely change between steps.</p>
<p>None of the seven fixes above is clever. They are the same things you would do for a human API consumer: less surface area, faster feedback, safe retries, and permissions that fail closed. With models it just becomes obvious much faster, because a model will happily call all 90 tools in the wrong order if you let it.</p>
<hr />
<p>First article, if you want the architecture part: <a href="https://dev.to/kontrcad/i-gave-my-browser-cad-an-mcp-server-now-the-model-builds-parts-for-5-roubles-4l3o">I gave my browser CAD an MCP server</a></p>
]]></content:encoded></item><item><title><![CDATA[I gave my browser CAD an MCP server. Now the model builds parts for 6 cents]]></title><description><![CDATA[I make KontrCAD — a parametric CAD that runs entirely in a browser. Not a viewer and not a mesh toy: sketches with a constraint solver, extrude, loft…]]></description><link>https://kontrcad.hashnode.dev/i-gave-my-browser-cad-an-mcp-server-now-the-model-builds-parts-for-6-cents</link><guid isPermaLink="true">https://kontrcad.hashnode.dev/i-gave-my-browser-cad-an-mcp-server-now-the-model-builds-parts-for-6-cents</guid><category><![CDATA[AI]]></category><category><![CDATA[mcp]]></category><category><![CDATA[cad]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Valery Lunev]]></dc:creator><pubDate>Wed, 02 Dec 2026 07:17:26 GMT</pubDate><content:encoded><![CDATA[<img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/fagqj5ak6q7ab9ce39ia.png" alt="The assistant building a logo from a reference image inside the editor" style="display:block;margin:0 auto" />

<p>I make KontrCAD — a parametric CAD that runs entirely in a browser. Not a viewer and not a mesh toy: sketches with a constraint solver, extrude, loft, sweep, fillets, assemblies. Everything is computed on the client, with no server round trips.</p>
<p>For a year the app had one obvious gap. Every simple part — a case for a board, a bracket, a lid for a box — I built by hand. The same twenty operations, in the same order, every time.</p>
<p>So I did what everyone does in 2026: I gave the model tools.</p>
<h2>Why MCP fits a CAD unusually well</h2>
<p>KontrCAD stores a project as a list of operations. A tool never touches geometry: it writes a parameterised operation into the model, and an executor replays the list. That is why a 2,000-operation project weighs 160 KB and why you can step through someone else's build like a slideshow.</p>
<p>The important part: the document is already an API. <code>create_primitive</code> with a box and dimensions, <code>extrude</code> with a sketch region, <code>boolean_subtract</code>, <code>fillet_chamfer</code> with edge coordinates. Every button in the UI writes exactly the same operation.</p>
<p>Which is precisely the shape of a tool call.</p>
<p>So an assistant does not "generate a mesh". It builds the same parametric model a human would, step by step, and afterwards you can open the history and change any number in it. The output stays editable. That is the difference from "AI generated an STL" demos: you get a model, not a mesh.</p>
<h2>Two transports: browser and desktop</h2>
<p><strong>Web version (WebMCP).</strong> The editor registers its tools inside the tab, and a client attached to that tab drives it directly. Chrome 126+ or Edge, plus a client that speaks WebMCP — the DeepSeek Harness extension, for example. Nothing to install, and the assistant sees exactly what you see. The catch is that the client does not always discover the tools immediately and has to be nudged.</p>
<p><strong>Desktop (Streamable HTTP).</strong> The Electron build starts a local MCP server on <code>http://127.0.0.1:3100/mcp</code>. Streamable HTTP, the transport current clients expect. It lives only while the app runs, listens on loopback only, and has no auth — fine for localhost, a terrible idea to expose. If you work in a browser, use the first option; if you want a "full" assistant inside Cursor or Claude Desktop, use the second.</p>
<h2>90 tools, and the context bill</h2>
<p>The server exposes 90 tools: nine groups plus three meta-tools.</p>
<ul>
<li><strong>core</strong> — scene reading, 18 primitive types, transforms, booleans, 3D text.</li>
<li><strong>sketch-start</strong> — a mini-group with the basic sketch tools an engineer needs, so a session can start sketching without pulling in the full <code>sketches</code> group.</li>
<li><strong>history</strong> — undo/redo/jump, parameter edits, operation descriptions.</li>
<li><strong>lesson</strong> — teaching mode: lesson state, step navigation, view/practice, UI highlighting.</li>
<li><strong>sketches</strong> — planes, entities, constraints, DOF analysis, extrude/revolve/sweep/loft.</li>
<li><strong>images</strong> — viewport screenshot, preview render, a four-view mosaic.</li>
<li><strong>library</strong>, <strong>files</strong>, <strong>advanced</strong> — model library, projects and export, fillets, threads, gears, arrays, assemblies.</li>
</ul>
<p>Dumping 90 schemas into every request is a good way to burn money and confuse the model. So the web build starts with <code>core</code> only — 15 tools plus 3 meta — and the assistant opens the group it needs when it realises it needs it.</p>
<h2>What actually saved tokens</h2>
<p><code>get_help(topic)</code><strong>.</strong> Long instructions are not in the schemas. The model asks for the one it needs, when it needs it. Schemas stay short.</p>
<p><code>batch</code><strong>.</strong> Several operations in one call, with <code>rollback: true</code>: if a step fails, the scene returns to the state before the batch instead of leaving debris that the model then has to clean up with more calls.</p>
<p><code>expect</code><strong>.</strong> Many tools accept the expected bounding box and volume. The model learns immediately that the size is wrong — no separate "let me check" round trip.</p>
<p><strong>Render for the model, not for humans.</strong> Instead of four screenshots it can request one image with four views, the part framed. One image instead of four, and no need to stitch context.</p>
<h2>The built-in chat</h2>
<p>External clients are fine for people who already live in Cursor. Everyone else wants a button.</p>
<p>So there is an AI tab inside the editor. You paste a provider key and it stays on your device — no proxy through my servers, which also means I never see your chats. DeepSeek, OpenAI, Claude through OpenRouter, Gemini, Groq, Mistral, GigaChat, Ollama, or any OpenAI-compatible endpoint. The model list comes from the provider's API, so new models appear without an app update.</p>
<img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/79j0rd67wxardf77h801.png" alt="AI assistant settings: provider, API key and model list" style="display:block;margin:0 auto" />

<p>Roles turned out to be the most useful part:</p>
<ul>
<li><strong>Engineer</strong> builds and edits, no confirmations. The default.</li>
<li><strong>Teacher</strong> explains and makes the student do the work. Ask it to "do it for me" and it answers with a two-to-four step plan and asks you to do step one.</li>
<li><strong>Analyst</strong> reads the scene — dimensions, edge coordinates, degrees of freedom — and asks before touching anything.</li>
</ul>
<p>Destructive calls from the last two arrive as a card with the tool name and arguments: allow or reject. If nobody answers within three minutes, the call is dropped.</p>
<p>The unexpected win was the Teacher role in classrooms: the assistant stopped being a "do my homework" button and became a TA that refuses to do the exercise.</p>
<h2>What does not work</h2>
<p>Models cannot read minds. "Make it pretty" produces garbage. You have to state dimensions and what mates with what.</p>
<p>Quality varies a lot. DeepSeek and Claude produce sane operation sequences. Weak and local models are still worth a try — a box, a lid, a bracket, especially through Ollama, where nothing leaves your machine. But do not expect a steam locomotive. For assemblies I would reach for something bigger.</p>
<p>And never let an assistant loose on a project you care about without a backup. The operation history is the undo button, and it has saved me more than once.</p>
<h2>The bill</h2>
<p>A chess set, built entirely by the assistant: 7.6M tokens, 99% of them cached. About six cents for the whole model, not per operation.</p>
<img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/hlxm5scxybz5xd7w193o.png" alt="Chess set built entirely by the assistant" style="display:block;margin:0 auto" />

<p>Caching does the heavy lifting. The tool schemas and the conversation barely change between steps, so almost everything is a cache hit. Without it the same run would cost an order of magnitude more.</p>
<p>That number is the real argument for MCP in a CAD: a full parametric model costs less than a coffee.</p>
<hr />
<p>KontrCAD is free and runs without registration: <a href="https://www.kontrcad.ru">kontrcad.ru</a>. The MCP setup guide is <a href="https://www.kontrcad.ru/pages/ii-assistent-v-kontrcad-instruktsiia-po-podkliucheniiu-mcp">here</a>.</p>
<p>If you build something with it, I would genuinely like to see what breaks.</p>
]]></content:encoded></item></channel></rss>