Skip to main content
Glama

Tokenbooks - crypto and fiat accounting and payments

Get Cost-Basis Lot Ledger

get_lot_ledger
Read-onlyIdempotent

Trace paginated cost-basis acquisition, disposal, transfer, and adjustment history across a portfolio, optionally narrowed by asset, wallet, event kind, accounting transaction, or date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number, starting at 1
sortNoSingle public sort field. Prefix with - for descending. Supported fields: timestamp, diff, value, price
limitNoMaximum items to return, maximum 100. Preferred MCP pagination field.
filterNoPublic AIP-160 filter string. Supported fields: id lot identifier (=, !=, in, not in), entry_id ledger-row identifier (=, !=, in, not in), asset_id (=, !=, in, not in), asset_spam (= true or false), entry_kind (=, !=, in, not in), wallet (=, !=, in, not in using chainId:address), portfolio_transaction_id (=, !=, in, not in), timestamp (=, !=, >, >=, <, <= with ISO datetimes). The asset display name is not filterable.
toDateNoOptional ISO timestamp upper bound
chainIdNoExact chain ID when filtering to one wallet; requires walletAddress
assetRefNoDeprecated compatibility selector for asset symbol or asset id. Prefer filter=asset_id.
fromDateNoOptional ISO timestamp lower bound
pageSizeNoDeprecated alias for limit, maximum 100. Prefer limit for new MCP calls.
entryKindNoFilter by lot entry kind (any of)
portfolioRefYesPortfolio exact name or slug
workspaceRefYesWorkspace exact name or slug
walletAddressNoExact case-sensitive wallet address when filtering to one wallet; requires chainId

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
paginationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "data": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "acquisitionTimestamp": {
      +            "type": "string"
      +          },
      +          "assetId": {
      +            "type": "string"
      +          },
      +          "assetIsSpam": {
      +            "type": "boolean"
      +          },
      +          "assetName": {
      +            "type": "string"
      +          },
      +          "assetSymbol": {
      +            "type": "string"
      +          },
      +          "diff": {
      +            "type": "string"
      +          },
      +          "entryId": {
      +            "type": "string"
      +          },
      +          "entryKind": {
      +            "enum": [
      +              "ADD",
      +              "DSP",
      +              "CUT",
      +              "MVE",
      +              "RES",
      +              "REL"
      +            ],
      +            "type": "string"
      +          },
      +          "id": {
      +            "type": "string"
      +          },
      +          "lotMethod": {
      +            "type": "string"
      +          },
      +          "operationType": {
      +            "enum": [
      +              "DEPOSIT_FIAT",
      +              "INCOME",
      +              "REFUND",
      +              "WITHDRAWAL_FIAT",
      +              "EXPENSE",
      +              "BUY",
      +              "SELL",
      +              "EXCHANGE",
      +              "SWAP",
      +              "MOVE",
      +              "INTERCOMPANY_SEND",
      +              "INTERCOMPANY_RECEIVE",
      +              "STAKE",
      +              "UNSTAKE",
      +              "PROTOCOL_DEPOSIT",
      +              "PROTOCOL_WITHDRAW",
      +              "VAULT_DEPOSIT",
      +              "VAULT_WITHDRAW",
      +              "LP_IN",
      +              "LP_OUT",
      +              "LOAN_BORROW",
      +              "LOAN_REPAY",
      +              "LOAN_LIQUIDATION",
      +              "LEND_GIVE",
      +              "LEND_WITHDRAW",
      +              "ADJUSTMENT",
      +              "UNCATEGORIZED",
      +              "SPAM"
      +            ],
      +            "type": "string"
      +          },
      +          "portfolioTransactionId": {
      +            "type": "string"
      +          },
      +          "positionId": {
      +            "type": "string"
      +          },
      +          "price": {
      +            "type": "string"
      +          },
      +          "timestamp": {
      +            "type": "string"
      +          },
      +          "txHash": {
      +            "minLength": 1,
      +            "type": "string"
      +          },
      +          "value": {
      +            "type": "string"
      +          },
      +          "walletAddress": {
      +            "type": "string"
      +          },
      +          "walletChainId": {
      +            "type": "string"
      +          },
      +          "walletName": {
      +            "type": "string"
      +          },
      +          "walletTransactionTransfers": {
      +            "items": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "chainId": {
      +                  "type": "string"
      +                },
      +                "txHash": {
      +                  "minLength": 1,
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "chainId",
      +                "txHash"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          }
      +        },
      +        "required": [
      +          "id",
      +          "entryId",
      +          "timestamp",
      +          "acquisitionTimestamp",
      +          "entryKind",
      +          "lotMethod",
      +          "diff",
      +          "value",
      +          "assetId",
      +          "assetIsSpam",
      +          "portfolioTransactionId",
      +          "walletTransactionTransfers"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "pagination": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "page": {
      +          "maximum": 9007199254740991,
      +          "minimum": -9007199254740991,
      +          "type": "integer"
      +        },
      +        "pageSize": {
      +          "maximum": 9007199254740991,
      +          "minimum": -9007199254740991,
      +          "type": "integer"
      +        },
      +        "totalCount": {
      +          "maximum": 9007199254740991,
      +          "minimum": -9007199254740991,
      +          "type": "integer"
      +        },
      +        "totalPages": {
      +          "maximum": 9007199254740991,
      +          "minimum": -9007199254740991,
      +          "type": "integer"
      +        }
      +      },
      +      "required": [
      +        "page",
      +        "pageSize",
      +        "totalCount",
      +        "totalPages"
      +      ],
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "data",
      +    "pagination"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds the useful behavioral trait of pagination ('paginated'), which is not in the annotations, but it does not disclose specifics like page-based caveats or ledger-entry semantics beyond what the schema and output schema provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single tight sentence that front-loads the core purpose and then appends the optional narrowing clause. Every word earns its place; there is no redundant filler or repetition of schema details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is a read-only, paginated query with a rich output schema, strong annotations, and 100% parameter documentation. The description covers the core purpose, scope, and optional filters, while the structured data covers return values and parameter syntax, so nothing essential is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 13 parameters thoroughly. The description adds semantic grouping by listing the narrowing dimensions (asset, wallet, event kind, accounting transaction, date), which maps cleanly to filter fields and helps an agent understand the tool's expressive scope.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Trace') and identifies a distinct resource: a cost-basis lot ledger spanning acquisitions, disposals, transfers, and adjustments. This clearly distinguishes it from siblings like get_journal_entry or list_portfolio_transactions without requiring schema inspection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context by framing the tool as a portfolio-wide ledger history query with optional narrowing dimensions. It does not explicitly name alternatives or exclusion conditions, but the purpose is specific enough that an agent can infer when it applies.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources