Strategy for managing context windows with Dashboard JSON · Issue #101 · grafana/mcp-grafana (original) (raw)
We eventually want LLMs to understand and possibly modify dashboards. The best way to do this is to access the dashboard JSON. An alternative is to provide a screenshot of the dashboard to a model that can understand images, which doesn't scale and can miss crucial context.
Providing modification tools is fairly trivial, but we need to be careful about context windows. Dashboard JSONs can be very large and users can use up their context limits without knowing. We can use this issue to discuss possible solutions, while adding disclaimers in the code for a start.
Some early thoughts:
- We could aim to provide the dashboard JSON to LLMs (via the get_dashboard_via_uid tool) only once. We then instruct the LLM to only send specific modifications. The update_dashboard tool can be built to take these specific updates instead, and validate them before applying.
- We could also provide features in get_dashboard_via_uid that can fetch only specific parts of the dashboard. Maybe it could even be a new, unique tool like get_dashboard_property. LLMs can then use this to fetch only the context they need.
I can see possible use-cases for both, and a complete solution would probably involve more features.