Version Packages - #33
Merged
Merged
Conversation
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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@iqai/defillama-mcp@1.0.8
Patch Changes
#32
f8794e1Thanks @Aliiiu! - Restore the shape-discipline and time-series Date-conversion exampleCall work that was lost whenmainwas force-pushed back to a pre-PR-fix(catalog): shape responses inside execute(); guide narrow-vs-broad #28 state by a compromised maintainer credential. The malicious commit has already been removed frommain(in PR Version Packages #31); this PR re-applies the substantive fixes from the merged-then-lost PR fix(catalog): shape responses inside execute(); guide narrow-vs-broad #28 and PR fix(catalog): demonstrate * 1000 Date conversion in time-series exampleCalls #30 on top of the now-clean main.What was lost (and is now restored):
Narrow-vs-broad guidance on broad list endpoints (
getProtocols,getChains,getDexsOverview,getFeesOverview,getOptionsOverview,getLatestPools,getStablecoins,getStablecoinChains). Descriptions now explicitly recommend the narrowgetX({slug})endpoint when the target is known and require projection/filtering insideexecute()before returning.getProtocolscalls out its payload size (~3k entries, several MB) so the size cost is visible up front.Response shaping in every
exampleCall. Each endpoint's example now demonstrates the right size-discipline pattern instead of returning the raw call:sort → slice(0, 20) → map(p => ({ ...specific fields }))getHistoricalChainTvl,getStablecoinCharts,getStablecoinPrices,getHistoricalPoolData) →series.slice(-90).map(p => ({ ...specific fields }))getProtocol,getDexSummary,getFeesSummary,getOptionsSummary) → destructure / pluck the 5-7 fields the question typically needs, instead of returning the full 30+ field objectprice.*) → unwrap nestedres.coins?.[key]?.price/.pricesinstead of returning the raw{ coins: { ... } }wrapperUnix-seconds-vs-milliseconds JS Date fix on the three
/v2-style time-series endpoints (getHistoricalChainTvl,getStablecoinCharts,getStablecoinPrices). DefiLlama returnsdateas Unix seconds; JSnew Date(n)expects milliseconds — so without the conversion the model gets1970-01-XXdates. The exampleCalls now demonstratenew Date(p.date * 1000).toISOString()inline.getHistoricalPoolDatais left alone because itstimestampis already an ISO string (asymmetry called out via a one-line comment so the model doesn't apply* 1000there by mistake).Upstream-shape correctness in
getProtocolexampleCall. The/protocol/{slug}endpoint returnstvlas a 2012-entry array of{date, totalLiquidityUSD}, not a top-level number;change_1d/change_7ddon't exist on this endpoint at all. The exampleCall now plucksp.tvl?.[p.tvl.length - 1]?.totalLiquidityUSDso a literaltvl: p.tvlprojection doesn't ship the full historical series back. (Latent bug inProtocolSchema/ProtocolDatatype — declaredtvl: number— still tracked separately, out of scope here.)getHistoricalPoolDataresponse unwrap. Schema declares{ data: HistoricalPoolItem[] }— the exampleCall now uses(series.data ?? []).slice(-90).map(...)instead ofseries.slice(-90)which would have TypeError'd.Null/undefined guards on the pool-lookup-then-fetch chain:
(pools.data ?? []).find(...)?.pool, thenif (!id) return { error: 'Pool not found' }before callinggetHistoricalPoolData, so the Zodpool: z.string()validation can't be tripped.New always-loaded instructions section "Shape responses inside
execute()— don't ship raw payloads back". States the rule (the sandbox is for trimming/shaping at the source; the return value should already be the small thing the agent will reason about), gives three labelled patterns (lists / time-series / summaries), notes the nested-coins[key]shape, and reiterates the narrow-vs-broad preference.What is unchanged from current
main:vitest.config.tspayload removed by PR Version Packages #31 stays removed.axiosstays at^1.12.2(the malicious downgrade to^1.9.0is not re-introduced).Original PRs whose content this restores: fix(catalog): shape responses inside execute(); guide narrow-vs-broad #28 (shape-large-payloads), fix(catalog): demonstrate * 1000 Date conversion in time-series exampleCalls #30 (time-series-date-conversion). See the audit thread on PR Version Packages #31 / the security incident notes for context on how the work was lost.