fix(projects/runelite-mcp): clarify unloaded account data

Treat unloaded collection totals as recent-only and reject RuneLite placeholder item definitions instead of reporting a string named null.

Assisted-by: pi (openai-codex/gpt-5.6-sol)
This commit is contained in:
Gabriel Fontes
2026-07-25 01:13:29 -03:00
parent 120b00f65a
commit 5fd3d9aada
4 changed files with 13 additions and 6 deletions
@@ -66,8 +66,10 @@ authoritative account valuation.
## `get_collection_log`
Returns native synchronized totals by top-level category and up to twelve recent
item IDs/names. RuneLite has no stable complete account-level collection-log entry
Returns native totals by top-level category when RuneLite has loaded them and up
to twelve recent item IDs/names. `recent_only` plus `synchronization: unknown`
prevents unloaded zero totals from looking authoritative. RuneLite has no stable
complete account-level collection-log entry
model; the tool therefore declares `completeness: summary`, exposes the recent
item date encoding only as `dateValueRaw`, and marks detailed entries unavailable
rather than scraping transient widgets or coupling to another plugin.
@@ -267,14 +267,16 @@ final class ProgressionSnapshotReader
JsonObject collectionLog()
{
JsonObject result = new JsonObject();
result.addProperty("availability", "current_summary");
int total = client.getVarpValue(VarPlayerID.COLLECTION_COUNT_MAX);
boolean totalsLoaded = total > 0;
result.addProperty("availability", totalsLoaded ? "current_summary" : "recent_only");
result.addProperty("completeness", "summary");
int unsynchronized = client.getVarpValue(VarPlayerID.COLLECTION_COUNT_UNSYNCED);
result.addProperty("synchronization", unsynchronized < 0 ? "unknown"
result.addProperty("synchronization", !totalsLoaded || unsynchronized < 0 ? "unknown"
: unsynchronized == 0 ? "current" : "unsynchronized");
JsonObject totals = new JsonObject();
totals.addProperty("obtained", client.getVarpValue(VarPlayerID.COLLECTION_COUNT));
totals.addProperty("total", client.getVarpValue(VarPlayerID.COLLECTION_COUNT_MAX));
totals.addProperty("total", total);
totals.add("bosses", countPair(VarPlayerID.COLLECTION_COUNT_BOSSES, VarPlayerID.COLLECTION_COUNT_BOSSES_MAX));
totals.add("raids", countPair(VarPlayerID.COLLECTION_COUNT_RAIDS, VarPlayerID.COLLECTION_COUNT_RAIDS_MAX));
totals.add("clues", countPair(VarPlayerID.COLLECTION_COUNT_CLUES, VarPlayerID.COLLECTION_COUNT_CLUES_MAX));
@@ -197,7 +197,8 @@ public class RuneLiteSnapshotProvider implements SnapshotProvider
else
{
ItemComposition definition = itemManager.getItemComposition(id);
if (definition == null)
if (definition == null || definition.getId() != id || definition.getName() == null
|| "null".equalsIgnoreCase(definition.getName()))
{
value.add("name", JsonNull.INSTANCE);
value.add("price", JsonNull.INSTANCE);
@@ -46,6 +46,8 @@ public class ProgressionSnapshotReaderTest
assertEquals(100, collection.getAsJsonObject("totals").get("obtained").getAsInt());
assertEquals(500, collection.getAsJsonObject("totals").get("total").getAsInt());
assertEquals("summary", collection.get("completeness").getAsString());
assertEquals("current_summary", collection.get("availability").getAsString());
assertEquals("current", collection.get("synchronization").getAsString());
}
private static Client client()