Posts

Showing posts from November, 2026

Emit an isometric cube as three SVG polygons and test its shared edges

An isometric cube is three polygons that have to meet along identical edges, and a vertex that is off by even one user unit can leave a gap or an overlap. This script emits the three faces with integer coordinates and checks the edges before you trust the SVG. Name the points once All geometry hangs off a center (100, 100) and two offsets, set in cx, cy, dx, dy = 100, 100, round(50 * sqrt(3)), 50 . The program names seven points: C , T , B , UR , LR , LL , UL . Each face is a list of those names. For a 30 degree edge with a vertical rise of 50, the exact horizontal run is 50 * sqrt(3) , which is 86.603. The code rounds it to 87 so every coordinate is an integer and the printed points are exact. The price is that the cube is only approximately isometric: the slanted edges are very slightly off true 30 degrees. from collections import Counter from math import sqrt cx, cy, dx, dy = 100, 100, round(50 * sqrt(3)), 50 print(f"dx = round(50*sqrt(3)) = {dx}; exact value {50 * sqrt(3...

An MCP server in pure Python, under 100 lines, where tools can only propose

First published on DEV . Many MCP tutorials start with a framework install and end with a tool that adds two numbers. This one uses only the Python standard library, and its tools do what matters once an agent can touch real systems: they ask, and they don't act. You get one file. Through MCP, a client can propose an action and list the queue. No MCP tool runs anything. A separate command line does that. 1. What MCP looks like on the wire A local MCP server is a program that reads JSON-RPC messages from stdin and writes replies to stdout, one JSON object per line. Three methods carry a tool server, plus ping so a client can check it's alive: initialize : the client says hello, you answer with your protocol version and capabilities. tools/list : you describe your tools with a JSON Schema for their arguments. tools/call : the client calls one, you return text. Two details bite first. Messages without an id are notifications and must not be answered, so skip them. And stdo...