Repository navigation
Only the error paths of one tool are tested #421
Description
Background
tests/mcp.test.ts has four tests, all on paid_call:
should map signature expiration ledger error to ERR_EXPIRED_AUTHORISATION
should map missing trustline error to ERR_MISSING_TRUSTLINE
should map 402 rejected error to ERR_PAYMENT_REJECTED
should return successfully on a successful call
bazaar_search has no tests at all — not the query path, not the empty-result
path, not the non-2xx path. ListTools is never exercised, so a malformed tool
schema would ship unnoticed.
The four that exist also construct errors as plain strings, which is what makes
L215's text-matching fragility invisible to the suite.
What to build
- Cover
bazaar_search: with and without a query, empty results, non-2xx, a
malformed body. - Cover
ListTools: the advertised tools, and that eachinputSchemais valid. - Cover the unknown-tool path.
- Where an upstream error is simulated, use a shape resembling what the real
library throws.
Acceptance criteria
-
bazaar_searchhas tests for success, empty, non-2xx and malformed body -
ListToolsis exercised and each schema validated - The unknown-tool path is covered
- Simulated errors resemble real ones
- The four existing tests still pass
Drips Wave · Complexity: Intermediate · 150 points
Repo: Divinity-Labs/Lens. The MCP server is src/mcp/server.ts
(BazaarMcpServer) with error codes in src/mcp/codes.ts. It is started by
npm run mcp:server → examples/mcp-server/run.ts, and there is an agent
example at examples/mcp-server/agent.ts. Tests are tests/mcp.test.ts.
Run the tests: npm test. The tests are vitest, not jest. A single file
is npx vitest run tests/mcp.test.ts.
Load test (prices) is already failing on main. Not your PR.
This surface signs with a real mainnet key. examples/mcp-server/run.ts
requires MCP_AGENT_SECRET_KEY_MAINNET and builds a signer for
stellar:pubnet. Anything you change here can move real money, so prefer
failing closed, and never log, echo or test with a real secret key.
Never elide an address, a contract id or a key in code, comments or
fixtures. A previous batch shortened a contract id and five contributors
invented plausible-looking ids to fill the gap. Write it in full or not at all.
An agent is the least able caller to notice a wrong answer. It will reason
over whatever it is handed, confidently. Prefer a structured error over a
best-effort result.
Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk
Activity
optimism932-dotcom commentedon Oct 17, 2026
@optimism932-dotcom has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @optimism932-dotcom to this issue.
KingDavid9999 commentedon Oct 17, 2026
@KingDavid9999 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @KingDavid9999 to this issue.
gpromise7077-web commentedon Oct 17, 2026
@gpromise7077-web has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @gpromise7077-web to this issue.
muazumikail1915-create commentedon Oct 17, 2026
@muazumikail1915-create has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @muazumikail1915-create to this issue.
AGWAM001 commentedon Oct 17, 2026
@AGWAM001 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @AGWAM001 to this issue.
solaawojobi00-bit commentedon Oct 17, 2026
@solaawojobi00-bit has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @solaawojobi00-bit to this issue.
pristabel commentedon Oct 17, 2026
@pristabel has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @pristabel to this issue.
drips-wave commentedon Oct 17, 2026
Congratulations, @AGWAM001! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.
🧑💻 @AGWAM001: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
AGWAM001 commentedon Oct 23, 2026
Follow-up on the review of #524 (now closed): re-audited against main after #521 landed as c55a980, and the coverage this issue asks for is already on main, so nothing is left to open here.
Measured on main (89bc678), comparing test bodies rather than titles:
The ~9,900-line gap in #524 was that branch re-adding what #521 had already shipped; its head also failed to parse (src/mcp/server.ts:886, duplicated handleHttpRequest parameters), which is why it could not simply be merged.
The one thing still live is split out to #607: .env.example declared MCP_MAX_PAYMENT_PRICE= twice, so the "Ceiling per paid_call" comment described a line dotenv never applied.
AGWAM001 commentedon Oct 23, 2026
Correction to my own comment above: I wrote that "the four legacy cases now use the shapes the real libraries throw". That was not true. Three of the four still used invented material, and the fourth cannot be made faithful without a source change. #608 rewrites the three so they can be:
Transaction signature expired. Signature expiration ledger 123 is less than current ledger 125appears in no installed package.@x402/fetch2.24.0 rethrows a scheme failure asFailed to create payment payload: <cause>(dist/esm/index.mjs:48), and@stellar/stellar-sdk13.3.0 saysThe transaction has expired(lib/webauth/utils.js:124, thrown asInvalidChallengeError).Responsewith an x402 error body, not as an Error.X-PAYMENT-RESPONSE, whichsrc/mcp/ledger.ts:163base64-decodes. The old stand-in had noheadersproperty at all, so no test ever reached that code path.The trustline case is left as a plain string, and it wants its own issue. Horizon answers
op_no_trustwithBadResponseError, whoseresult_codeslive aterr.response.extras.result_codes, whileextractStructuredSignalreadserr.result_codes(src/mcp/codes.ts:118). I constructed a realnew BadResponseError(message, problemDocument)from@stellar/stellar-sdk13.3.0 and ran it throughclassifyPaidCallError: it returnedERR_BAD_REQUEST, notERR_MISSING_TRUSTLINE— the instance's own keys areconstructor,response,name, soresult_codesis never on the error at all. That means the structured branch is one a real Horizon failure can never reach, and every genuine trustline failure is classified by text matching today.main's owndescribe('BazaarMcpServer paid_call error classification')block setserr.result_codesdirectly, so it is asserting against a field no dependency populates.That is a source bug, and a tests-only PR cannot fix it without dressing a behaviour change as a fixture, so #608 leaves
src/alone. Verified there:tsc --noEmitexit 0,npm run buildexit 0, 75 passed intests/mcp.test.ts, full suite 1445 passed | 1 skipped, andcheck-dropped-testssees 1340 cases on both sides.drips-wave commentedon Oct 23, 2026
This issue has been completed by @AGWAM001 as part of the Stellar Wave Program's 10th Wave 🥳
😎 @AGWAM001: You earned 150 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.
Merge PR #608: simulate real library shapes in the paid_call tests (c…