Fix agent-facing papercuts in the MCP tool surface - #2
Open
usehoplite[bot] wants to merge 2 commits into
Open
Conversation
Handshake instructions still described the removed per-call credential design; rewrite them around the environment-based design as a tested constant. Point stale credentials.gcp.billing_table references at CLOUD_TOOLS_GCP_BILLING_TABLE. Reject inverted or equal date ranges locally instead of letting the provider answer. Attach failed OVH/Cloudflare calls to cross-cloud summary rows and flag summary.partial so partial results never read as clean. Fix README tool counts (eight, not thirteen/seven). Record the Rust toolchain install in the project setup script. Co-authored-by: ship fast <buildfastapps@gmail.com>
cargo fmt --all --check fails on main under rustfmt 1.98 in src/clouds/aws/cloudwatch_logs.rs and src/clouds/aws/ec2.rs — import ordering only, no behavior change. Required for the repository's own CI to pass. Co-authored-by: ship fast <buildfastapps@gmail.com>
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.
What and why
Audited the main user flows — the MCP tool calls and the guidance clients receive at handshake — and fixed the highest-impact papercuts, each verified with unit tests.
1. Handshake instructions contradicted the schema.
with_instructionsstill told every MCP client to "pass an IAM Role ARN per call", "pass service_account_json", "pass app_key, app_secret, consumer_key per call", "pass api_token and account_id per call" — the pre-refactor credential-carrying design. None of those fields exist in the current tool schemas, so an agent that followed the instructions would hit schema errors on every call. Rewritten around the actual design (credentials from the server's environment, optionaltarget.role_arn/target.project_idsselectors), extracted to aSERVER_INSTRUCTIONSconstant, with a regression test asserting it namescheck_accessand the environment and never mentions the removed per-call fields. Also fixed the tool descriptions and the GCP costs note that referenced the nonexistentcredentials.gcp.billing_table→CLOUD_TOOLS_GCP_BILLING_TABLE(and the wrong env-var nameCLOUD_GCP_BILLING_TABLEinsrc/clouds/gcp/billing.rs).2. Inverted date ranges failed remotely with a confusing error.
get_costspassedstart_date/end_datestraight to the provider; a swapped or equal range came back as the provider's own "invalid parameter" after the request had already travelled there. Newchecked_dateshelper rejects malformed, equal, or inverted ranges locally and names both values in the error. Wiring: AWS service costs, AWSdata_transfer, and GCP costs all use it now.3. Cross-cloud summary turned API failures into clean zero bills. The OVH and Cloudflare arms ended in
.unwrap_or_default(), so a 401 or quota error silently rendered as"total_billed_usd": 0— exactly the "clean bill of health" failure this codebase's own doctrine warns about (seetaken()infetch_gcp_inventory). Both arms now usetaken()and attach the failures to the provider row aserrors, and the summary adds"partial": truewhen any provider row carries an error, so a partial result never reads as a zero. The GCP arm also keeps a failed analysis's error visible instead of dropping it.4. Stale README counts. "the thirteen tools above" → "the tools above"; "All seven declare
readOnlyHint" → "All eight".5. Setup script records the Rust toolchain install (
.hoplite/settings.json): fresh sandboxes runmise install rust@stable && mise use -g rust@stableso this Rust project can be built and tested out of the box.Verification
cargo test: 23 passed, 0 failed (including 3 new regression tests)cargo clippy --all-targets: cleancargo fmt --check: only two pre-existing drift files remain (in files this PR does not modify); all touched files are clean