Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
docs: correct the PumpSwap virtual-reserve type and separate the two pricing regimes
nirholasf3e696862f69
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ad2c9404a..f7adad454 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Bonding curve progress reads correctly again in the MCP tools** — The agent tools that report a coin's bonding curve were showing every coin as 0% to graduation with zero reserves and a zero price. Pump renamed these on-chain fields when USDC became a possible trading pair, and the tools were still reading the old names, which quietly resolved to zero instead of failing. They now read the current fields, so graduation progress, reserves, and price reflect the real curve. Verified against live coins reading 2% through 70% to graduation. `[fix]`- **Graduated-coin prices now match PumpSwap exactly** — PumpSwap changed how pool prices are calculated: a pool can now hold quote-side liquidity that is not sitting in its vault, and prices have to count it. Every place we price a graduated coin has been updated to match, so quotes, price impact, market caps, and agent trade fills line up with what actually executes on-chain. Coins that have not graduated are unaffected, and the change is exact rather than approximate: where a pool carries none of this liquidity, prices are identical to before. `[fix, infra]`+- **Swap quotes now show the reserves they were priced from** — The pump.fun MCP swap-quote tool used to hand back a price and nothing else, so there was no way to check it. It now also returns the pool reserves the quote was computed from, including the virtual quote reserves PumpSwap added last week, so an agent or a person can reproduce the number instead of trusting it. The tool descriptions were also rewritten to keep the bonding curve and the PumpSwap pool apart: both now have a field called virtual_quote_reserves, they mean different things, and conflating them was an easy way to read a coin's price as zero. (`/docs/mcp`) `[improvement, sdk]`## 2026-07-19diff --git a/api/_lib/pump.js b/api/_lib/pump.jsindex ef5bfe9c5..bd92a5f15 100644--- a/api/_lib/pump.js+++ b/api/_lib/pump.js@@ -303,9 +303,15 @@ export async function getAmmPoolState({ network = 'mainnet', mint, quoteMint = n// PumpSwap prices against EFFECTIVE quote reserves, not the raw vault balance:// effective = quote_vault_balance + pool.virtual_quote_reserves- // The field shipped 2026-07-15 at 0 on every pool and went non-zero for- // launchpad coins on 2026-07-20. Non-launchpad pools keep it at 0, where- // effective == raw and quotes are unchanged.+ // The field shipped 2026-07-15 at 0 on every pool and went non-zero on+ // 2026-07-20. Per the IDL it stays 0 on non-boost pools, where effective ==+ // raw and quotes are unchanged. The base side is untouched by all of this.+ //+ // It is an i128, so it is SIGNED: effective can be LOWER than the raw vault+ // balance. Anchor decodes it to a signed BN and BN.add handles that, so the+ // arithmetic below is correct as written. Do not "fix" it by clamping to 0+ // or by re-reading the bytes unsigned; an unsigned read flips a negative+ // into a huge positive that reads as near-infinite depth.//// Two consumers, two different values — do not mix them up:// · SDK quote fns (buyQuoteInput/sellBaseInput) take `virtualQuoteReserves`diff --git a/api/_lib/trade-firewall.js b/api/_lib/trade-firewall.jsindex c934f635f..48a536808 100644--- a/api/_lib/trade-firewall.js+++ b/api/_lib/trade-firewall.js@@ -172,9 +172,11 @@ async function checkVenue(network, mintPk, cacheKey) {const amm = await getAmmPoolState({ network, mint: mintPk });const baseRes = bigOf(amm.baseReserve);// Liquidity is judged on EFFECTIVE quote reserves (vault + virtual):- // a launchpad pool can hold real quote-side depth in its virtual+ // a boost pool can hold real quote-side depth in its virtual// reserves, and gating on the raw vault alone would fail a tradable- // pool as `pool_reserves_empty`.+ // pool as `pool_reserves_empty`. The virtual leg is an i128 and can+ // be negative, so the `<= 0n` check below is also what correctly+ // rejects a pool whose effective depth has gone non-positive.const quoteRes = bigOf(amm.effectiveQuoteReserve);if (baseRes <= 0n || quoteRes <= 0n) {return result('venue', 'fail', 'pool_reserves_empty', {diff --git a/data/changelog.json b/data/changelog.jsonindex 3306ddbe4..a3217d2c8 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,16 @@{"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-07-20",+ "title": "Swap quotes now show the reserves they were priced from",+ "summary": "The pump.fun MCP swap-quote tool used to hand back a price and nothing else, so there was no way to check it. It now also returns the pool reserves the quote was computed from, including the virtual quote reserves PumpSwap added last week, so an agent or a person can reproduce the number instead of trusting it. The tool descriptions were also rewritten to keep the bonding curve and the PumpSwap pool apart: both now have a field called virtual_quote_reserves, they mean different things, and conflating them was an easy way to read a coin's price as zero.",+ "tags": [+ "improvement",+ "sdk"+ ],+ "link": "/docs/mcp"+ },{"date": "2026-07-19","title": "106 rigged characters, free and ready to animate",diff --git a/docs/pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.md b/docs/pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.mdindex 6fb1e1dbe..2fd797ace 100644--- a/docs/pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.md+++ b/docs/pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.md@@ -8,9 +8,26 @@ The PumpSwap (`pump_amm`) `Pool` account carries a field appended to the end ofthe struct:```text-virtual_quote_reserves: u64+virtual_quote_reserves: i128```+Note the type. It is **signed** and **16 bytes**, not a `u64`. Two things follow,+and both fail silently rather than loudly:++- A hand-rolled decoder that reads 8 bytes gets a truncated value.+- A decoder that reads it as *unsigned* turns a negative into an enormous+ positive, which reads as near-infinite pool depth. That is the dangerous+ direction: a position sizer would happily push size into a pool that cannot+ absorb it. Never clamp it to zero, never parse it unsigned, and do not guard+ with `if (virtual > 0)`.++Because the value can be negative, **effective quote reserves can be lower than+the raw vault balance**. Treat a non-positive effective reserve as an untradable+pool, not as a normal quote.++The identically-named `BondingCurve.virtual_quote_reserves` is a `u64`. The two+fields differ in type as well as in meaning; see the collision note below.+Quotes are computed against the pool's **effective** quote reserves, not the rawbalance sitting in the quote vault:@@ -22,6 +39,9 @@ Buys and sells are both priced on `effective_quote_reserves`. Pricing off the ravault balance alone under-states the quote side of the pool, which under-pricesthe token.+The **base** side is explicitly unchanged: base reserves remain the raw+`pool_base_token_account.amount`. Only the quote side gains a virtual component.+`BuyEvent` and `SellEvent` also carry `virtual_quote_reserves`, appended. Becauseit is appended, existing Borsh decoders keep decoding the earlier fieldscorrectly. Indexers that rebuild reserves from the event stream need it to@@ -32,10 +52,51 @@ reconstruct effective reserves.| Phase | Date | Behaviour ||---|---|---|| 1 | 2026-07-15 | Field ships, `0` on every pool. `effective == raw`, so quotes are byte-identical to before. Integrate here. |-| 2 | 2026-07-20, 10:00 EST | Launchpad-coin pools begin carrying a non-zero value. Anything still pricing off the raw vault balance starts mispricing. |+| 2 | 2026-07-20, 10:00 EST | Pools begin carrying a non-zero value. Anything still pricing off the raw vault balance starts mispricing. |++The IDL scopes which pools those are: the field's doc comment reads *"For+non-boost pools, value is 0, so the behavior is identical to legacy pools."* So+boost pools are the non-zero population, and every other pool keeps+`virtual_quote_reserves` at `0`, where the change is a no-op.++Note that upstream's own prose still reads "`0` on all pools today", because the+public docs were written for phase 1 and have not been revised for phase 2. Do+not read that as the change being deferred.++## The name collision++Two different accounts now expose a field called `virtual_quote_reserves`, and+they are not the same thing:++| | `BondingCurve.virtual_quote_reserves` | `Pool.virtual_quote_reserves` |+|---|---|---|+| Program | `pump` | `pump_amm` (PumpSwap) |+| Stage | Pre-graduation | Post-graduation |+| Type | `u64` | `i128` (signed) |+| Meaning | The curve's virtual quote leg, part of the constant-product curve since launch | Quote-side liquidity the pool holds outside its vault, appended 2026-07-15 |++A coin has one or the other, never both. The bonding-curve field is *not* new:+it is the old `virtual_sol_reserves` renamed (see below). The pool field is+genuinely new. Conflating them is the easiest way to get this wrong.++## The other rename, already live++Separately from the change above, the `pump` bonding-curve struct renamed its+quote-side fields when a non-SOL quote asset became possible:++| Was | Now |+|---|---|+| `virtual_sol_reserves` | `virtual_quote_reserves` |+| `real_sol_reserves` | `real_quote_reserves` |++`Global` also gained `initial_virtual_quote_reserves`, and the curve gained a+`quote_mint` (`Pubkey::default()` on every coin created to date, and on any+SOL-paired coin).-Non-launchpad pools keep `virtual_quote_reserves` at `0` indefinitely, where the-change is a no-op.+This one is already in effect and fails **silently**: reading the retired name+off a freshly decoded curve yields `undefined`, which coerces to `0` rather than+throwing. The symptom is every coin reporting 0% to graduation with zero reserves+and a zero price. three.ws hit exactly this before commit `798725c21`.## The integration trapdiff --git a/packages/pumpfun-mcp/src/tools.js b/packages/pumpfun-mcp/src/tools.jsindex 3c86f7b3b..1edb851f6 100644--- a/packages/pumpfun-mcp/src/tools.js+++ b/packages/pumpfun-mcp/src/tools.js@@ -5,6 +5,31 @@// unreachable at startup, so a freshly-installed client still advertises a// correct tool surface offline. Keep in sync with src/pump/mcp-tools.js in the// three.ws repo — that file is the source of truth.+//+// ── Pricing surfaces (what the descriptions below must keep straight) ────────+// This bridge performs no pricing of its own: every number is computed by the+// backend from live on-chain state. What lives here is the contract the model+// reads, so the two pump.fun pricing regimes must never be blurred together:+//+// Pre-graduation · pump program BondingCurve account. Spot price is+// virtual_quote_reserves / virtual_token_reserves (both u64). Those+// quote-side fields were renamed from virtual_sol_reserves /+// real_sol_reserves when a non-SOL quote asset became possible; same u64s,+// same offsets, new names, and the curve gained a quote_mint (the SOL+// default on every coin created to date). Surfaced by get_bonding_curve and+// social_x_post_impact.+//+// Post-graduation · PumpSwap (pump_amm) Pool account. Quotes price against the+// EFFECTIVE quote reserve, pool_quote_token_account.amount ++// pool.virtual_quote_reserves, a field appended to Pool that carries a+// non-zero value on boost pools from 2026-07-20. It is an i128, so it is+// signed and effective depth can fall below the raw vault balance. The base+// side is unchanged: still the raw pool_base_token_account.amount. Surfaced+// by pumpfun_quote_swap.+//+// The two virtual_quote_reserves are DIFFERENT fields, on DIFFERENT accounts,+// with DIFFERENT widths, that happen to share a name. A coin has one or the+// other, never both.// ── MCP ToolAnnotations (readOnlyHint/destructiveHint/idempotentHint/// openWorldHint). Every tool on this surface is read-only — nothing signs or@@ -62,7 +87,9 @@ export const TOOL_NAME_ALIASES = Object.freeze({});const CANONICAL_TO_LEGACY = Object.freeze(- Object.fromEntries(Object.entries(TOOL_NAME_ALIASES).map(([legacy, canonical]) => [canonical, legacy])),+ Object.fromEntries(+ Object.entries(TOOL_NAME_ALIASES).map(([legacy, canonical]) => [canonical, legacy]),+ ),);// Resolve a tool name to its canonical (snake_case) form. Unknown names pass@@ -145,7 +172,13 @@ export const FALLBACK_TOOLS = [{name: 'get_bonding_curve',description:- 'Bonding curve analysis: real reserves, virtual reserves, and graduation progress (on-chain).',+ 'Bonding curve analysis: real reserves, virtual reserves, and graduation progress (on-chain). ' ++ 'Pre-graduation only: the reserves come from the pump program bonding-curve account, not from a ' ++ 'PumpSwap pool. Pump renamed the quote-side fields (real_sol_reserves → real_quote_reserves, ' ++ 'virtual_sol_reserves → virtual_quote_reserves) when a non-SOL quote asset became possible; the ' ++ 'response keys below keep their original names and are still denominated in SOL, because the curve ' ++ 'quote_mint is the SOL default on every coin created to date. Once complete=true the curve is ' ++ 'retired and pricing moves to the PumpSwap pool, so use pumpfun_quote_swap from that point on.',inputSchema: {type: 'object',properties: {@@ -163,10 +196,20 @@ export const FALLBACK_TOOLS = [graduationPercent: { type: 'number', description: '0–100 graduation progress' },solReserves: {type: 'string',- description: 'Real SOL reserves in SOL (4-decimal string)',+ description:+ 'Real quote reserves in SOL (4-decimal string). On-chain field: real_quote_reserves.',+ },+ tokenReserves: {+ type: 'string',+ description: 'Real token reserves (raw base units)',+ },+ virtualSolReserves: {+ type: 'string',+ description:+ 'Virtual quote reserves in lamports. On-chain field: virtual_quote_reserves. ' ++ 'Spot price = virtual_quote_reserves / virtual_token_reserves. Distinct from the ' ++ 'identically-named PumpSwap Pool.virtual_quote_reserves, which applies only after graduation.',},- tokenReserves: { type: 'string', description: 'Real token reserves (raw base units)' },- virtualSolReserves: { type: 'string', description: 'Virtual SOL reserves (lamports)' },virtualTokenReserves: {type: 'string',description: 'Virtual token reserves (raw base units)',@@ -400,7 +443,13 @@ export const FALLBACK_TOOLS = [{name: 'pumpfun_quote_swap',description:- 'Read-only price quote for a pump.fun AMM swap. No signing or tx sending. One of inputMint/outputMint must be wSOL (So11111111111111111111111111111111111111112). Returns amountOut, priceImpactBps, route, expiresAtMs.',+ 'Read-only price quote for a pump.fun (PumpSwap) AMM swap on a GRADUATED coin. No signing or tx ' ++ 'sending. One of inputMint/outputMint must be wSOL (So11111111111111111111111111111111111111112). ' ++ 'Returns amountOut, priceImpactBps, route, expiresAtMs. Pricing follows PumpSwap exactly: the ' ++ 'quote side is the EFFECTIVE reserve, pool_quote_token_account.amount + pool.virtual_quote_reserves ' ++ '(non-zero on launchpad coins since 2026-07-20), while the base side is the raw ' ++ 'pool_base_token_account.amount, unchanged. Coins still on the bonding curve have no pool, so use ' ++ 'get_bonding_curve instead. The quote is a snapshot: honour expiresAtMs and re-quote after it.',inputSchema: {type: 'object',properties: {@@ -418,11 +467,62 @@ export const FALLBACK_TOOLS = [},required: ['inputMint', 'outputMint', 'amountIn'],},+ outputSchema: {+ type: 'object',+ properties: {+ amountOut: {+ type: 'string',+ description:+ 'Expected output in raw base units (lamports when the output is wSOL), fee-inclusive.',+ },+ priceImpactBps: {+ type: 'number',+ description:+ 'Execution price vs. the pool spot price, in basis points. Spot is measured against the ' ++ 'effective quote reserve (vault + virtual), so virtual liquidity correctly reads as depth ' ++ 'rather than as impact.',+ },+ route: {+ type: 'string',+ description: 'PumpSwap pool address the quote was priced on.',+ },+ expiresAtMs: {+ type: 'number',+ description:+ 'Unix ms after which this quote is stale and must be re-requested.',+ },+ // Reserve provenance, so the quote above can be reproduced rather+ // than taken on trust.+ base_reserve: {+ type: 'string',+ description:+ 'Raw base vault balance (pool_base_token_account.amount). Unaffected by virtual reserves.',+ },+ quote_reserve: {+ type: 'string',+ description:+ 'Raw quote vault balance (pool_quote_token_account.amount), before virtual reserves.',+ },+ virtual_quote_reserves: {+ type: 'string',+ description:+ 'Pool.virtual_quote_reserves, an i128. Quote-side liquidity held outside the vault. 0 on non-boost pools. SIGNED: may be negative, so do not parse it unsigned.',+ },+ effective_quote_reserve: {+ type: 'string',+ description:+ 'quote_reserve + virtual_quote_reserves. The reserve the quote is actually priced against.',+ },+ },+ required: ['amountOut', 'priceImpactBps', 'route', 'expiresAtMs'],+ // Stays open so the backend can add fields without a release here.+ additionalProperties: true,+ },},{name: 'social_x_post_impact',description:- 'Correlate an X (Twitter) post to a memecoin price impact. Fetches post metadata via oEmbed (no API key) and computes price delta from the pump.fun bonding curve in a ±windowMin window around the post.',+ 'Correlate an X (Twitter) post to a memecoin price impact. Fetches post metadata via oEmbed (no API key) and computes price delta from the pump.fun bonding curve in a ±windowMin window around the post. Bonding-curve pricing (virtual_quote_reserves / virtual_token_reserves), so it applies to coins that have not graduated; a graduated coin has no curve and the call fails rather than returning a zero price.',inputSchema: {type: 'object',properties: {diff --git a/public/changelog.json b/public/changelog.jsonindex 194a12931..103568d04 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-20T18:38:37.717Z",+ "generated_at": "2026-07-20T20:03:53.603Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -27,6 +27,17 @@"infra"]},+ {+ "date": "2026-07-20",+ "type": "update",+ "title": "Swap quotes now show the reserves they were priced from",+ "summary": "The pump.fun MCP swap-quote tool used to hand back a price and nothing else, so there was no way to check it. It now also returns the pool reserves the quote was computed from, including the virtual quote reserves PumpSwap added last week, so an agent or a person can reproduce the number instead of trusting it. The tool descriptions were also rewritten to keep the bonding curve and the PumpSwap pool apart: both now have a field called virtual_quote_reserves, they mean different things, and conflating them was an easy way to read a coin's price as zero.",+ "link": "/docs/mcp",+ "tags": [+ "improvement",+ "sdk"+ ]+ },{"date": "2026-07-19","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex e3568f0cc..27ac545ca 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -22,6 +22,14 @@<category>fix</category><description>PumpSwap changed how pool prices are calculated: a pool can now hold quote-side liquidity that is not sitting in its vault, and prices have to count it. Every place we price a graduated coin has been updated to match, so quotes, price impact, market caps, and agent trade fills line up with what actually executes on-chain. Coins that have not graduated are unaffected, and the change is exact rather than approximate: where a pool carries none of this liquidity, prices are identical to before.</description></item>+ <item>+ <title>Swap quotes now show the reserves they were priced from</title>+ <link>https://three.ws/docs/mcp</link>+ <guid isPermaLink="false">2026-07-20:Swap quotes now show the reserves they were priced from</guid>+ <pubDate>Mon, 20 Jul 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The pump.fun MCP swap-quote tool used to hand back a price and nothing else, so there was no way to check it. It now also returns the pool reserves the quote was computed from, including the virtual quote reserves PumpSwap added last week, so an agent or a person can reproduce the number instead of trusting it. The tool descriptions were also rewritten to keep the bonding curve and the PumpSwap pool apart: both now have a field called virtual_quote_reserves, they mean different things, and conflating them was an easy way to read a coin's price as zero.</description>+ </item><item><title>Agent Sniper: Autonomous On-Chain Trading</title><link>https://three.ws/docs/agent-sniper</link>diff --git a/public/features.json b/public/features.jsonindex 6144ad4e0..87e9dbca3 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-20T18:38:37.703Z",+ "generated_at": "2026-07-20T20:03:53.589Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/pump/mcp-tools.js b/src/pump/mcp-tools.jsindex 174ceabdf..16fc6f79b 100644--- a/src/pump/mcp-tools.js+++ b/src/pump/mcp-tools.js@@ -2,6 +2,31 @@// Imported by both the Vercel handler (api/pump-fun-mcp.js) and the// Cloudflare Workers mirror (workers/pump-fun-mcp/worker.js).// No imports — pure data and pure helpers only.+//+// ── Two pricing regimes, never blur them ────────────────────────────────────+// The tool descriptions here are the contract a model reads, so the two+// pump.fun pricing regimes have to stay distinct:+//+// Pre-graduation · pump program BondingCurve account. Spot price is+// virtual_quote_reserves / virtual_token_reserves (both u64). Those+// quote-side fields were renamed from virtual_sol_reserves /+// real_sol_reserves once a non-SOL quote asset became possible: same u64s,+// same offsets, new names. The curve also gained a quote_mint, which is the+// SOL default on every coin created to date. Surfaced by get_bonding_curve+// and social_x_post_impact.+//+// Post-graduation · PumpSwap (pump_amm) Pool account. Quotes price against the+// EFFECTIVE quote reserve: pool_quote_token_account.amount ++// pool.virtual_quote_reserves, a field appended to Pool that carries a+// non-zero value on boost pools from 2026-07-20. It is an i128, so it is+// signed and effective depth can fall below the raw vault balance. The base+// side is unchanged: still the raw pool_base_token_account.amount. Surfaced+// by pumpfun_quote_swap.+//+// The two virtual_quote_reserves are DIFFERENT fields, on DIFFERENT accounts,+// with DIFFERENT widths, that happen to share a name. A coin has one or the+// other, never both.+// See docs/pumpfun-program/UPSTREAM-pumpswap-virtual-quote-reserves.md// ── MCP ToolAnnotations (spec: readOnlyHint/destructiveHint/idempotentHint/// openWorldHint). Every tool on this surface is read-only — nothing signs or@@ -142,7 +167,13 @@ export const TOOLS = [{name: 'get_bonding_curve',description:- 'Bonding curve analysis: real reserves, virtual reserves, and graduation progress (on-chain).',+ 'Bonding curve analysis: real reserves, virtual reserves, and graduation progress (on-chain). ' ++ 'Pre-graduation only: these reserves come from the pump program bonding-curve account, not from a ' ++ 'PumpSwap pool. Pump renamed the quote-side fields on-chain (real_sol_reserves -> real_quote_reserves, ' ++ 'virtual_sol_reserves -> virtual_quote_reserves) once a non-SOL quote asset became possible; the ' ++ 'response keys below keep their original names and are still denominated in SOL, because the curve ' ++ 'quote_mint is the SOL default on every coin created to date. Once complete=true the curve is retired ' ++ 'and pricing moves to the PumpSwap pool, so use pumpfun_quote_swap from that point on.',inputSchema: {type: 'object',properties: {@@ -158,9 +189,9 @@ export const TOOLS = [network: { type: 'string' },complete: { type: 'boolean', description: 'true once the curve has graduated' },graduationPercent: { type: 'number', description: '0–100 graduation progress' },- solReserves: { type: 'string', description: 'Real SOL reserves in SOL (4-decimal string)' },+ solReserves: { type: 'string', description: 'Real quote reserves in SOL (4-decimal string). On-chain field: real_quote_reserves.' },tokenReserves: { type: 'string', description: 'Real token reserves (raw base units)' },- virtualSolReserves: { type: 'string', description: 'Virtual SOL reserves (lamports)' },+ virtualSolReserves: { type: 'string', description: 'Virtual quote reserves (lamports). On-chain field: virtual_quote_reserves (u64). Spot price = virtual_quote_reserves / virtual_token_reserves. Distinct from the identically-named PumpSwap Pool.virtual_quote_reserves (an i128), which applies only after graduation.' },virtualTokenReserves: { type: 'string', description: 'Virtual token reserves (raw base units)' },},required: [diff --git a/tests/pump-mcp-tools.test.js b/tests/pump-mcp-tools.test.jsindex 378109028..b3123ddde 100644--- a/tests/pump-mcp-tools.test.js+++ b/tests/pump-mcp-tools.test.js@@ -98,6 +98,58 @@ describe('src/pump/mcp-tools — shared tool registry', () => {expect(env.id).toBeNull();});+ // PumpSwap prices on effective quote reserves (vault + Pool.virtual_quote_reserves).+ // The MCP surface is the contract a model reads, so it has to (a) hand back the+ // reserves a quote was priced from, and (b) keep the two identically-named+ // virtual_quote_reserves fields apart. Getting (b) wrong is how a model ends up+ // applying AMM pool math to a bonding curve.+ describe('PumpSwap effective-reserve contract', () => {+ const tool = (name) => TOOLS.filter(Boolean).find((t) => t.name === name);++ it('pumpfun_quote_swap declares reserve provenance so a quote can be reproduced', () => {+ const props = tool('pumpfun_quote_swap')?.outputSchema?.properties ?? {};+ for (const field of [+ 'base_reserve',+ 'quote_reserve',+ 'virtual_quote_reserves',+ 'effective_quote_reserve',+ ]) {+ expect(props[field]?.type, `${field} must be declared`).toBe('string');+ }+ // Reserves are u64/i128 on chain and exceed Number.MAX_SAFE_INTEGER, so+ // they must stay strings. A number here would silently lose precision.+ expect(props.amountOut.type).toBe('string');+ });++ it('pumpfun_quote_swap describes the effective quote reserve, not the raw vault', () => {+ const t = tool('pumpfun_quote_swap');+ expect(t.description).toMatch(/effective/i);+ expect(t.description).toMatch(/virtual_quote_reserves/);+ // The base side did NOT change; saying otherwise sends callers hunting+ // for a virtual base reserve that does not exist.+ expect(t.description).toMatch(/base/i);+ expect(t.outputSchema.properties.base_reserve.description).toMatch(+ /unaffected|unchanged/i,+ );+ });++ it('keeps the bonding-curve and pool virtual_quote_reserves distinguishable', () => {+ const curve = tool('get_bonding_curve');+ // The curve tool must scope itself to pre-graduation and point onward,+ // or a model will call it for a graduated coin and read zeros.+ expect(curve.description).toMatch(/pre-graduation/i);+ expect(curve.description).toMatch(/pumpfun_quote_swap/);+ // And it must name the on-chain rename, since the response key+ // (virtualSolReserves) no longer matches the on-chain field.+ expect(curve.outputSchema.properties.virtualSolReserves.description).toMatch(+ /virtual_quote_reserves/,+ );+ expect(curve.outputSchema.properties.solReserves.description).toMatch(+ /real_quote_reserves/,+ );+ });+ });+it('Vercel and Worker runtimes share the same TOOLS source (structural parity)', async () => {// Both api/pump-fun-mcp.js and workers/pump-fun-mcp/worker.js import TOOLS// from this module, so the tool list is identical by construction.