Skip to content

rust(feat): ENG-15355: add create_declarative_chart MCP tool with Explore sharelinks - #813

Draft
alexa-sift wants to merge 1 commit into
mainfrom
eng-15355-add-declarative-chart-support-to-the-sift-mcp
Draft

alexa-sift wants to merge 1 commit into
mainfrom
eng-15355-add-declarative-chart-support-to-the-sift-mcp

Conversation

@alexa-sift

Copy link
Copy Markdown

Description

ENG-15355, ENG-15356 (parent ENG-15354)

Adds create_declarative_chart to the Sift MCP. An MCP client sends a declarative chart spec (YAML or JSON) and gets back an Explore sharelink, or path-level validation issues it can fix and resend.

  • New service/declarative calls the backend's declarative:migrate, declarative:validate (strict), and declarative:sharelink REST endpoints. The declarative protos are not in this repo, so there is no sift_rs client.
  • The tool passes the spec through verbatim and does not parse it, so no YAML dependency is added. Any spec the backend accepts is valid, including multi-chart specs and layout. Specs with exactly one chart display inline in Sift agent chat.
  • Results are structured: exploreUrl, shortLink, and the migrated spec on success; invalid_spec or service_unavailable with {path, message} issues otherwise. A 400 from any endpoint is treated as an invalid spec.
  • Retries, backoff, and timeouts match the agents' existing declarativeClient.ts: 3 attempts, 250ms exponential backoff, 10s per request, retrying 408, 429, and 5xx. This lives in the declarative service because policy::with_retry only handles gRPC status codes.
  • No --allow-create gate: a sharelink is a view link, like explore_url, and the backend dedupes links by spec hash.
  • explore_url and get_data descriptions now send plot and chart requests to the new tool. The sift skill gains references/declarative-charts.md covering user-supplied specs and plain-language requests.
  • Adds create_declarative_chart to tool_events.json. The matching ClientEvent value still needs to land in azimuth's client_events.proto.

Follow-ups, not in this PR:

  • Map non-retryable 401, 403, and 404 responses to a no-retry result (TODO in tool/explore/mod.rs).
  • Consider one overall deadline for the three calls. The worst case today is about 90s if the backend stalls.
  • Land the azimuth client_events.proto value before the sift-cli release, or analytics for this tool start only after azimuth deploys.
  • Serve the declarative schema from a backend endpoint and point the skill reference at it.

Verification

  • cargo test --offline -p sift_mcp: 610 passed, 0 failed. New tests cover YAML and JSON specs reaching every endpoint unchanged, multi-chart and layout specs forwarded rather than rejected, invalid and service-unavailable paths, 400 handling, retries, and timeouts.
  • cargo clippy --offline -p sift_mcp --all-targets --all-features --no-deps -- -D warnings -A deprecated -A clippy::too_many_arguments: clean. The two allows cover pre-existing failures on Rust 1.98 in unchanged code (rmcp ServerInfo deprecation in server/mod.rs and startup.rs, too_many_arguments in report_templates). sift_connect also fails a new clippy lint, unrelated to this change.
  • cargo fmt -p sift_mcp --check: clean.
  • Not yet run: a manual sift-cli mcp check from Claude Code against a live backend.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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