Skip to content

Trim the skill by ~2k tokens and fix its broken examples (#13, #14) - #16

Open
asbis wants to merge 1 commit into
claude/shrink-mcp-packagefrom
claude/issues-13-14
Open

asbis wants to merge 1 commit into
claude/shrink-mcp-packagefrom
claude/issues-13-14

Conversation

@asbis

@asbis asbis commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Stacked on #12 (part of the unreleased 1.30.1).

Closes #13. Closes #14.

#13 — Save tokens in SKILL.md

Measured with claude plugin details, the skill costs 16.2k → 14.2k tokens each time it loads.

Removed from SKILL.md:

  • The 29-tool table (~970 tokens). The MCP client already sends every tool with its full schema in tools/list, so the table was a copy. It had also drifted: it didn't know modify_shape's edits mode. I checked first that its advice is in the tool descriptions themselves (e.g. "don't call setup_shape_project", "prefer verify_shape").
  • The table of contents (~220 tokens). Agents read the whole file, not anchors.
  • "Complete Examples" (~880 tokens). The examples move to get_api_reference({ category: "examples" }), which already existed and served two examples. The skill's intro and its "Need API depth" branch now point there. I chose this over the issue's "separate file" suggestion because the README and INSTALL.md install the skill as one SKILL.md via curl (Codex, Vibe, Claude without the plugin); a second file would silently be missing there.

Three of the seven examples were broken

I ran every example through validate_syntax and preview_shape before moving it.

Example Problem Fix
L-bracket all three holes missed the part ("no material removal"): XZ extrudes toward −Y, holes were at +Y placeOn(…, "XZ", { into: "+Y" }), holes at Y = 15
Flanged cylinder render failed: all-edges .fillet() straight after .fuse() fillet only the junction (inPlane("XY", 5)), then hollow with a 2 mm floor
Wheel with spoke slots slot #5 missed: translate-then-rotate double-rotated it; also the hand-rolled cut loop the skill warns against patterns.cutAt + patterns.polar(6, 25, { orientOutward: true })

All 8 examples in get_api_reference({ category: "examples" }) now render with no warnings, and I checked the three fixed ones visually (4-view renders).

#14 — Absolute paths in examples/tsconfig.json

The paths/typeRoots pointed at one Windows machine. In a fresh clone (tested in an isolated copy with no node_modules/shapeitup stub above it), tsc -p examples/tsconfig.json reports 26 × "Cannot find module 'shapeitup'"; with the relative paths, 0 errors. Editor-only: neither the build nor the runtime reads this file. No other tracked file has a personal absolute path (test fixtures use fake C:\Users\me).

Test plan

  • pnpm lint, pnpm build, pnpm test (65 files, 1231 tests)
  • All 8 examples entries extracted from the built server's get_api_reference output, rendered via preview_shape: clean
  • get_api_reference({ search: "orientOutward" }) finds the new wheel example
  • Fresh-clone tsc check for Absolute path references in tsconfig.json  #14, before/after
  • claude plugin details: skill on-invoke ~16.2k → ~14.2k

Found on the way, not fixed here: validate_syntax reports false "unknown method" warnings for Math.cos/Math.sin and the finder methods inDirection/inPlane.

🤖 Generated with Claude Code

#13: SKILL.md drops the 29-tool table (the MCP client already lists
every tool, and the table had drifted: no modify_shape `edits` mode),
the table of contents, and the "Complete Examples" section. Those
examples move to get_api_reference({ category: "examples" }), which
already served two on demand. 16.2k -> 14.2k tokens per load, measured
with `claude plugin details`.

Three of the seven examples were wrong and are fixed on the way:
the L-bracket's holes missed the part (now placeOn + holes at Y=15),
the flanged bottle failed to render (fillet only the junction, then
hollow), and a wheel slot missed (patterns.cutAt + patterns.polar
instead of a hand-rolled loop). All eight examples now render with no
warnings.

#14: examples/tsconfig.json pointed at absolute paths on one Windows
machine; in a fresh clone the 26 `shapeitup` imports in the examples
could not be resolved. The paths are relative now (0 errors).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
shapeitup-landing Ready Ready Preview Oct 13, 2026 3:16pm UTC

@martinrieder

Copy link
Copy Markdown

Wow, the examples got moved into the code now... Taking a closer look there, I realize that every MCP tool definition, its description, and implementation lives in packages/mcp-server/src/tools.ts: ~8,900 lines in one file for 29 tools across authoring, rendering, verification, simulation, and export could be move to separate modules with no behavior change.

It does not only hold tool definitions. It also contains cross-cutting infrastructure: per-pid heartbeat reading and workspace-root arbitration for multi-window VS Code setups, the version footer logic, viewer status blocks, the headless SVG/PNG render helper, and the WebSocket subscriber-bus wiring. That is at least four distinct responsibilities beyond tool registration, which strengthens the case for splitting by domain.

martinrieder added a commit to martinrieder/ShapeItUp that referenced this pull request Oct 14, 2026
CONTRIBUTING.md's 'Adding a New MCP Tool' checklist requires a new tool
to be documented in getApiReference() — verify_design was registered
without its entry. This adds a 'verification' category covering the
acceptance-gate toolset:

- verify_design as the anchor: the one-call battery (render, collisions,
  simulation, export), skip flags, the render-failure short-circuit
- the surrounding gates: check_collisions (exact intersect vs the
  battery's AABB prefilter), sweep_check, run_simulation's author-
  declared assertions, validate_joints, describe_geometry/
  preview_finder
- the author-declared vs tool-driven distinction: expectedContacts and
  sim.assertions travel with the design file; call-time args merge with
  file-declared rules

Also updates the category listing in get_api_reference's no-arg response.

Conflict analysis vs open upstream PRs: PR asbis#16's tools.ts hunks touch
executeWithPersistedParams, registrations, and the examples category
content — not the category list or the refs map. PR asbis#18 edits only
description strings in registrations that predate verify_design. Both
trial-merge cleanly. The SKILL.md table row (the other checklist item)
is deliberately NOT done: PR asbis#16 deletes the entire tool table, so the
correct post-asbis#16 contribution is a prose line in its verification
cluster, not a row that would conflict.

Tests: 2 new (category exists, documents the gate toolset and the
author-declared concept). Suite 1264 total; pnpm lint and pnpm build
clean.

Co-authored-by: martinrieder <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 900762b7 Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants