Skip to content

Synfig MCP Token Budget Baseline

Phase A0 Baseline Audit (Target: v0.8.0-rc1) Measured with OpenAI cl100k_base and o200k_base tokenizers (tiktoken v0.14.0) Vision model calculations use published tile formulas for OpenAI (detail=high/low), Claude, and Gemini.

1. tools/list Token Budget & Profile Ceilings

  • Default Profile (all): 118 tools, 112,441 bytes, 30,199 tokens (cl100k_base).
  • Minimal Profile (core): 22 tools, 17,215 bytes, 4,553 tokens (cl100k_base).

[!NOTE] The server ships with the complete all profile enabled by default. Clients with a tight context budget can switch to core, which reduces the initial system prompt payload from 30,199 tokens to 4,553 tokens.

Profile Allocations & Measured Counts

Profile (SYNFIG_MCP_PROFILE) Tool Count Measured Tokens (cl100k) Measured Tokens (o200k) Status vs Ceiling
core 22 4,553 4,574 ✅ Pass (< 5000)
anim 29 6,742 6,763 ❌ Exceeds (4500)
fx 39 9,155 9,181 ❌ Exceeds (4500)
rig 40 10,700 10,735 ❌ Exceeds (3000)
assets 28 6,982 6,997 ❌ Exceeds (2000)
review 26 6,266 6,290 ❌ Exceeds (4000)
all 118 30,199 30,271 ✅ Pass (< 32000)

[!NOTE] The CI gate (server/tests/unit/test_token_budget.py) enforces 5,000 tokens for core and 32,000 tokens for all. The core surface carries the live-Studio tools (studio_info, access_approve) and the four capability meta-tools, so the earlier 3,000-token target no longer reflects the shipped surface.


2. Response Size of Top 15 Common Calls

Measured against real server output in headless mode:

Tool Invocation Response Chars cl100k_base Tokens o200k_base Tokens Token Budget Ceiling
health_check() 569 156 158 < 312
doc_new(160x120) 193 84 84 < 200
doc_list() 389 122 122 < 244
layer_add(circle) 251 85 85 < 200
scene_tree() 1228 363 363 < 726
doc_info() 389 122 122 < 244
param_set(radius=2.5) 325 118 118 < 236
param_get(radius) 232 56 56 < 200
anim_time_set(1.5s) 17 11 11 < 200
anim_time_get() 17 11 11 < 200
anim_keyframe_list() 0 0 0 < 200
history_undo() 21 8 8 < 200
render_frame(160x120) 138 53 53 < 200
schema_list_layers() 11 2 2 < 200
schema_get_layer(circle) 2709 720 720 < 1440

3. Vision Preview Image Token Model

Vision model consumption per single preview or contact-sheet image:

Resolution & Use Case Pixels Claude 3/3.5 (px/750) Gemini 1.5/2.0 (258/tile) OpenAI Detail=High OpenAI Detail=Low
160x120 (Thumbnail / Icon) 19,200 26 258 255 85
320x240 (Quick review / Iteration) 76,800 103 258 255 85
480x270 (16:9 SD preview) 129,600 173 258 255 85
640x480 (Standard preview) 307,200 410 258 425 85
960x540 (High-detail half-HD) 518,400 692 516 765 85
1280x720 (720p HD frame) 921,600 1229 516 1105 85
1920x1080 (1080p full frame) 2,073,600 2765 1548 1105 85
640x640 (2x2 Contact sheet - 4 frames) 409,600 547 258 765 85
960x960 (3x3 Contact sheet - 9 frames) 921,600 1229 1032 765 85

Visual Review Loop Optimization Takeaways

  1. Quick Iteration Default: 320x240 consumes only 103 Claude tokens / 258 Gemini tokens / 255 OpenAI tokens while providing sufficient visual fidelity to detect layout, clipping, and motion errors.
  2. Contact Sheet Efficiency: A 4-frame 640x640 contact sheet costs 547 Claude / 516 Gemini / 765 OpenAI tokens, whereas rendering 4 individual 640x480 frames costs 1,640 Claude / 1,032 Gemini / 3,060 OpenAI tokens (a 3x to 4x token reduction).
  3. Zoom-In Crops: Use targeted 320x240 crops on detected violation regions instead of full 1080p frame re-renders.

4. Top 15 Heaviest Tool Definitions (tools/list)

Tool Name Schema Size (chars) cl100k_base Tokens o200k_base Tokens Optimization Target in A1
rig_sheet_from_image 2,773 736 738 Move detailed guidance to synfig://guide/ and trim enum descriptions
production_run 2,348 573 574 Move detailed guidance to synfig://guide/ and trim enum descriptions
asset_import 1,642 435 434 Move detailed guidance to synfig://guide/ and trim enum descriptions
rig_sheet_slice 1,576 431 432 Move detailed guidance to synfig://guide/ and trim enum descriptions
render_sequence 1,443 427 427 Move detailed guidance to synfig://guide/ and trim enum descriptions
sprite_slice 1,493 420 421 Move detailed guidance to synfig://guide/ and trim enum descriptions
view_set 1,377 403 403 Move detailed guidance to synfig://guide/ and trim enum descriptions
canvas_set_properties 1,381 393 393 Move detailed guidance to synfig://guide/ and trim enum descriptions
character_motion_apply 1,391 393 394 Move detailed guidance to synfig://guide/ and trim enum descriptions
procedural_asset_generate 1,396 392 389 Move detailed guidance to synfig://guide/ and trim enum descriptions
doc_set_properties 1,315 389 389 Move detailed guidance to synfig://guide/ and trim enum descriptions
rig_bone_add 1,173 365 365 Move detailed guidance to synfig://guide/ and trim enum descriptions
render_start 1,221 360 360 Move detailed guidance to synfig://guide/ and trim enum descriptions
render_contact_sheet 1,231 359 359 Move detailed guidance to synfig://guide/ and trim enum descriptions
render_video 1,149 340 340 Move detailed guidance to synfig://guide/ and trim enum descriptions

5. Token Baseline CI Enforcement

Enforced via server/tests/unit/test_token_budget.py. - Asserts tools/list total tokens do not exceed the baseline without profile gating. - Asserts typical single tool call responses stay strictly below 500 tokens.