Conversation
…ompt
Three new MCP tools that broaden the AI's reach over the editor
beyond the fixed controlEditor operations. Companion to phoenix-pro's
browser handlers.
mcp-editor-tools.js:
- execJsInEditor: caller-supplied JS evaluated in Phoenix's own JS
space (parent window — distinct from execJsInLivePreview which
targets the iframe). Same shape as execJsInLivePreview (code +
optional timeoutMs, floored at 5000, default 10000, no upper limit).
Description lists the __PR helpers and points the model at editorDocs
before writing non-trivial JS, plus a hint to use takeScreenshot
(with arbitrary CSS selector) to verify mutations visually.
- editorPreferences: list / get / set with explicit scope. Description
teaches user-friendly scope names ("system-wide" / "for this project"
/ "just for this session") and tells the model to PICK a sensible
scope per pref nature instead of reflexively offering all three.
No platform-specific paths in the description — purely API-level.
- editorDocs: returns absolute apiDocsPath (the build-mirrored API
reference) + apiDocsURL + featureDocsURL + sourceRepoURL. Tool DOES
NOT fetch content — it's just a "where to look" index so the model
Read / Greps the bundled docs and WebFetches the live ones.
- takeScreenshot description rewritten with a clean binary selector
rule (live preview vs everything else) plus an arbitrary-CSS-
selector option for verifying execJsInEditor mutations.
- getEditorState response now appends a fallback hint pointing the
model at takeScreenshot for any UI question the JSON doesn't
answer (Problems panel, sidebar, etc.).
claude-code-agent.js (system prompt + tool registration):
- allowedTools + agents.researcher / agents.coder gain the three new
mcp__phoenix-editor__ tool names.
- New "live preview is" definition line so the model has a mental
model of what the preview shows.
- Broadened getEditorState trigger: ALWAYS call it first on any
question that references the user's current work — not just "what
file am I on" but also implicit-context phrasings like "the page",
"this layout", "the nav bar", "scroll down on the page". Stops the
model from blind whole-codebase grep when context is one tool call
away.
- Phoenix-vs-Claude-Code name-collision rule: when the user says
"set / configure / change X" without naming a product, default to
editorPreferences. Don't touch ~/.claude/, ~/.claude.json, or the
built-in update-config skill unless the user explicitly mentions
"Claude" / "Claude Code" / "SDK" / "agent". Skip and ask if
genuinely ambiguous.
- Per-tool entries for execJsInEditor, editorPreferences, editorDocs
added to the tool list.
build/api-docs-generator.js + .gitignore:
- copyApiDocsToSrcNode() mirrors docs/API-Reference/ →
src-node/apiDocs/ in a finally block so a partial generation (e.g.
one source file's jsdoc errored mid-batch) still ships whatever
made it. Cross-platform via fs.cp + path.join.
- /src-node/apiDocs added to root .gitignore.
strings.js: AI_CHAT_TOOL_EDITOR_JS ("Inspecting editor"),
AI_CHAT_TOOL_EDITOR_PREFERENCES ("Editor preferences"),
AI_CHAT_TOOL_EDITOR_DOCS ("Editor docs").
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Three new MCP tools that broaden the AI's reach over the editor beyond the fixed controlEditor operations. Companion to phoenix-pro's browser handlers.
mcp-editor-tools.js:
claude-code-agent.js (system prompt + tool registration):
build/api-docs-generator.js + .gitignore:
strings.js: AI_CHAT_TOOL_EDITOR_JS ("Inspecting editor"), AI_CHAT_TOOL_EDITOR_PREFERENCES ("Editor preferences"), AI_CHAT_TOOL_EDITOR_DOCS ("Editor docs").