<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shansjl</title>
    <description>The latest articles on DEV Community by shansjl (@frankshan001).</description>
    <link>https://dev.to/frankshan001</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4235586%2Fadfe4982-4d1e-4c8f-922e-a2d958124e3e.png</url>
      <title>DEV Community: shansjl</title>
      <link>https://dev.to/frankshan001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/frankshan001"/>
    <language>en</language>
    <item>
      <title>Designing MCP tools for a stateful app: what I learned building an AI-editable video timeline</title>
      <dc:creator>shansjl</dc:creator>
      <pubDate>Mon, 09 Nov 2026 17:03:20 +0000</pubDate>
      <link>https://dev.to/frankshan001/designing-mcp-tools-for-a-stateful-app-what-i-learned-building-an-ai-editable-video-timeline-4mfp</link>
      <guid>https://dev.to/frankshan001/designing-mcp-tools-for-a-stateful-app-what-i-learned-building-an-ai-editable-video-timeline-4mfp</guid>
      <description>&lt;p&gt;Most MCP servers wrap something stateless: search an API, read a file, query a DB. I built one for something very stateful — a multitrack video project that a human is editing at the same time. This post is about the design choices that made that workable. The project is &lt;a href="https://github.com/frankShan001/CutVoke" rel="noopener noreferrer"&gt;CutVoke&lt;/a&gt;, an MIT-licensed, local-first video editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: AI video ends in an MP4
&lt;/h2&gt;

&lt;p&gt;Agent-driven video pipelines usually render a file and stop. When a caption is wrong or a cut is late, you re-run the pipeline or rebuild everything in a human editor. I wanted the agent's output to &lt;em&gt;be&lt;/em&gt; an editable project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture in one picture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjclpspmc3vdivfv62md.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjclpspmc3vdivfv62md.png" alt="how it works" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Python engine owns a persistent project (tracks, clips, captions, keyframes, effects), stored locally.&lt;/li&gt;
&lt;li&gt;Four front doors share it: a React editor (&lt;code&gt;cutvoke serve&lt;/code&gt;, loopback only), an MCP server (&lt;code&gt;cutvoke mcp --data …&lt;/code&gt;, stdio), an HTTP API, and a CLI.&lt;/li&gt;
&lt;li&gt;FFmpeg renders previews and exports. Desktop builds bundle it.&lt;/li&gt;
&lt;li&gt;There is no model inside. The agent is whatever you already use.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lesson 1: give the agent a lease, not a lock-free free-for-all
&lt;/h2&gt;

&lt;p&gt;When a person is dragging clips and an agent is running a 15-step edit, you need a rule for who writes. CutVoke uses an &lt;strong&gt;editing lease&lt;/strong&gt;: the agent calls &lt;code&gt;edit_lock&lt;/code&gt;, renews it during long jobs, and releases it on success or failure. The UI shows that an agent is editing. Commits also carry &lt;code&gt;expectedRevision&lt;/code&gt;, so a stale plan is rejected instead of silently clobbering human work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 2: dry runs and batches beat "be careful" prompts
&lt;/h2&gt;

&lt;p&gt;Instead of telling the model to be careful, make carefulness cheap. Supported commands can be dry-run with &lt;code&gt;command_preview&lt;/code&gt;. Related changes go into &lt;code&gt;edit.batch&lt;/code&gt;, which is &lt;strong&gt;one undo step&lt;/strong&gt; for the human. A stable &lt;code&gt;commandId&lt;/code&gt; makes retries idempotent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 3: let the agent see pixels, not JSON
&lt;/h2&gt;

&lt;p&gt;A timeline JSON can be perfectly valid and still look terrible: captions off-screen, a title over a face, a black frame at a cut. &lt;code&gt;preview_frames&lt;/code&gt; returns real rendered PNGs (up to 6 timestamps per call), captions and titles included. The guide tells agents to check frames around cuts, transitions and caption intervals — and to first check whether the client can actually read tool images at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 4: keep the tool catalog small and lazy
&lt;/h2&gt;

&lt;p&gt;A video editor has a lot of commands. Dumping every schema into context hurts smaller models. Discovery is layered: &lt;code&gt;editor_help&lt;/code&gt; (onboarding + recipes) → &lt;code&gt;commands_list({"includeSchemas": false, "query": "caption"})&lt;/code&gt; → &lt;code&gt;editor_help({"topic":"command","command":"caption.patch"})&lt;/code&gt; for the exact payload schema.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson 5: objects, not pixels, for the things people fix most
&lt;/h2&gt;

&lt;p&gt;The most common post-AI fix is text. Captions are individual objects: &lt;code&gt;project_lookup&lt;/code&gt; finds a line by its text, &lt;code&gt;caption.patch&lt;/code&gt; changes words, timing or style. Transcript-based cutting works the same way: locate a sentence, audition it, preview the impact of deleting it, confirm, undo in one step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Downloads (prerelease, unsigned): &lt;a href="https://github.com/frankShan001/CutVoke/releases/tag/v0.3.5" rel="noopener noreferrer"&gt;https://github.com/frankShan001/CutVoke/releases/tag/v0.3.5&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;From source: &lt;code&gt;pip install -e .&lt;/code&gt;, build the editor, &lt;code&gt;cutvoke doctor --json&lt;/code&gt;, then &lt;code&gt;python skills/cutvoke-editor/scripts/demo.py --output .artifacts/first-edit&lt;/code&gt; builds a 12-second edit over real stdio MCP.&lt;/li&gt;
&lt;li&gt;The README has two complete edits with source footage and editable projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's early and I'd value feedback on the agent API more than anything: if you've built tools for stateful apps, what would you do differently?&lt;/p&gt;

&lt;p&gt;⭐ Repo: &lt;a href="https://github.com/frankShan001/CutVoke" rel="noopener noreferrer"&gt;https://github.com/frankShan001/CutVoke&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>mcp</category>
      <category>video</category>
    </item>
  </channel>
</rss>
