mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 14:22:28 +08:00
fix: revert edit_diagram tool description to original (#115)
This commit is contained in:
@@ -282,31 +282,13 @@ Notes:
|
|||||||
},
|
},
|
||||||
edit_diagram: {
|
edit_diagram: {
|
||||||
description: `Edit specific parts of the current diagram by replacing exact line matches. Use this tool to make targeted fixes without regenerating the entire XML.
|
description: `Edit specific parts of the current diagram by replacing exact line matches. Use this tool to make targeted fixes without regenerating the entire XML.
|
||||||
|
CRITICAL: Copy-paste the EXACT search pattern from the "Current diagram XML" in system context. Do NOT reorder attributes or reformat - the attribute order in draw.io XML varies and you MUST match it exactly.
|
||||||
WHEN TO USE:
|
IMPORTANT: Keep edits concise:
|
||||||
- Changing text labels or values
|
- COPY the exact mxCell line from the current XML (attribute order matters!)
|
||||||
- Modifying colors, styles, or visual properties
|
- Only include the lines that are changing, plus 1-2 surrounding lines for context if needed
|
||||||
- Adding or removing individual elements (1-3 elements)
|
- Break large changes into multiple smaller edits
|
||||||
- Repositioning specific elements
|
- Each search must contain complete lines (never truncate mid-line)
|
||||||
- Any small, targeted modification
|
- First match only - be specific enough to target the right element`,
|
||||||
|
|
||||||
WHEN TO USE display_diagram INSTEAD:
|
|
||||||
- Creating a new diagram from scratch
|
|
||||||
- Major restructuring (reorganizing layout, changing diagram type)
|
|
||||||
- Adding many new elements (more than 3)
|
|
||||||
- After 3 failed edit_diagram attempts
|
|
||||||
|
|
||||||
CRITICAL RULES:
|
|
||||||
1. Copy-paste the EXACT search pattern from the "Current diagram XML" in system context
|
|
||||||
2. Do NOT reorder attributes - attribute order in draw.io XML varies, you MUST match exactly
|
|
||||||
3. Always include the element's id attribute for unique targeting
|
|
||||||
4. Include complete lines (never truncate mid-line)
|
|
||||||
5. For multiple changes, use separate edits in the array
|
|
||||||
|
|
||||||
ERROR RECOVERY:
|
|
||||||
- If pattern not found, check attribute order matches current XML exactly
|
|
||||||
- Retry up to 3 times with adjusted patterns
|
|
||||||
- After 3 failures, use display_diagram instead`,
|
|
||||||
inputSchema: z.object({
|
inputSchema: z.object({
|
||||||
edits: z.array(z.object({
|
edits: z.array(z.object({
|
||||||
search: z.string().describe("EXACT lines copied from current XML (preserve attribute order!)"),
|
search: z.string().describe("EXACT lines copied from current XML (preserve attribute order!)"),
|
||||||
|
|||||||
Reference in New Issue
Block a user