Skip to content

Send diagnostic view state as model context to MCP host#30

Open
rafavalls wants to merge 1 commit intomainfrom
rafavalls/send-model-context
Open

Send diagnostic view state as model context to MCP host#30
rafavalls wants to merge 1 commit intomainfrom
rafavalls/send-model-context

Conversation

@rafavalls
Copy link
Copy Markdown
Contributor

@rafavalls rafavalls commented Apr 20, 2026

Summary

  • Adds web/hooks/use-model-context.ts — a debounced hook that pushes the current diagnostic state to the MCP host via app.updateModelContext
  • Wires the hook into DiagnosticsPage so the host always knows whether the user is on the home screen, analyzing a URL, or viewing a specific report (including title, URL, health score, and truncated report content)
  • Clears context on unmount

Test Plan

  • Open the diagnostics tool in the MCP host and verify context updates appear when navigating between home, loading, and report views
  • Verify context is cleared when the tool is unmounted

Summary by cubic

Send the Diagnostics view state to the MCP host as model context so the host always knows what the user is looking at. Adds a debounced hook and wires it into DiagnosticsPage.

  • New Features
    • Added web/hooks/use-model-context.ts — debounced (500ms) updates via app.updateModelContext.
    • Sends view states: home (recent diagnostics summary), analyzing (URL), and report (title, URL, id, health score, date, summary, and report preview truncated to 2000 chars).
    • Integrated into DiagnosticsPage; updates on view/history changes and clears context on unmount.

Written for commit 3e58afe. Summary will update on new commits.

Sends the current view (home, analyzing, or report) as model context
so the studio host always knows what diagnostic the user is looking at.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
site-diagnostics 3e58afe Apr 20 2026, 09:22 PM

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.

1 participant