Skip to content

feat(mcp): add ooxml_preset_shape tool for Annex D adjust-guide lookup#10

Open
shbernal wants to merge 1 commit into
superdoc-dev:mainfrom
shbernal:feat/preset-shape-geom-tool
Open

feat(mcp): add ooxml_preset_shape tool for Annex D adjust-guide lookup#10
shbernal wants to merge 1 commit into
superdoc-dev:mainfrom
shbernal:feat/preset-shape-geom-tool

Conversation

@shbernal

@shbernal shbernal commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • Adds a new ooxml_preset_shape MCP tool that returns the ordered adjust-value guide names (adj, adj1, adj2, hf, vf) for any DrawingML <a:prstGeom> preset shape
  • Data is curated statically from ECMA-376 Annex D presetShapeDefinitions.xml (256 shape-guide pairs), following the same opc-parts.ts pattern already used for OPC package metadata
  • The server description in handleInitialize is updated to describe four tool families and explicitly note that ooxml_search cannot answer Annex D geometry questions — directing agents to use ooxml_preset_shape instead
  • data/sources.json gets a ecma-376-annex-d-dml-geometries provenance entry explaining why this corpus is curated statically rather than ingested

Motivation

Annex D ships as a separate electronic addenda ZIP and is never ingested by the PDF pipeline. As a result, calling ooxml_search for questions like "what adjust guides does round2SameRect take?" returns nothing useful. This gap caused a real bug in downstream code: round2SameRect requires adj1/adj2 guides rather than the generic adj that roundRect uses, and without this tool the agent had no way to discover that.

Fixes #9

Files changed

File Change
apps/mcp-server/src/preset-shape-geom.ts New — static lookup table + lookupShapeGuides / listAdjustableShapes exports
apps/mcp-server/src/ooxml-tools.ts Import, tool def, type union extension, dispatch case, format helpers
apps/mcp-server/src/mcp.ts Server description updated (three → four families, Annex D gap noted)
data/sources.json Annex D provenance entry added

Test plan

  • Call ooxml_preset_shape with shape: "round2SameRect" — should return adj1, adj2
  • Call ooxml_preset_shape with shape: "roundRect" — should return adj
  • Call ooxml_preset_shape with no args — should return full list of ~180 adjustable shapes
  • Call ooxml_preset_shape with shape: "rect" — should return "no adjust values" message
  • bun run typecheck passes with no new errors

🤖 Generated with Claude Code

Adds a new tool family to the MCP server that exposes adjust-value guide
names (adj, adj1, adj2, hf, vf) for every adjustable DrawingML preset
shape — data sourced from ECMA-376 Annex D presetShapeDefinitions.xml,
which the PDF ingestion pipeline does not index.

- preset-shape-geom.ts: curated static lookup table (256 shape-guide
  pairs) with lookupShapeGuides() and listAdjustableShapes() exports
- ooxml-tools.ts: ooxml_preset_shape tool definition, dispatch case, and
  three format helpers (report / no-guides / list)
- mcp.ts: server description updated to four tool families; Annex D gap
  explicitly noted so agents know to use ooxml_preset_shape instead of
  ooxml_search for geometry questions
- data/sources.json: ecma-376-annex-d-dml-geometries provenance entry

Closes superdoc-dev#9
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.

MCP missing Annex D preset shape geometry definitions (presetShapeDefinitions.xml)

1 participant