Skip to main content
Glama
xinrong-meng

My Finance MCP Server

list_transactions

Retrieve stored financial transactions with pagination and category filtering to analyze spending patterns and track portfolio allocations.

Instructions

List stored transactions from the JSON ledger with optional pagination and filtering.

Args:
    limit: Maximum number of transactions to return (default 20)
    offset: Number of transactions to skip from the beginning (default 0)
    category: Optional category filter (case-insensitive)

Returns:
    Dictionary containing total count, pagination info, and transactions with index field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
categoryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `list_transactions` tool handler function. It is registered via the `@mcp.tool()` decorator. Loads transactions from JSON, filters by optional category, adds indices, applies pagination (offset/limit), and returns structured dictionary with totals and pagination info.
    @mcp.tool()
    def list_transactions(limit: int = 20, offset: int = 0, category: Optional[str] = None) -> Dict[str, Any]:
        """
        List stored transactions from the JSON ledger with optional pagination and filtering.
    
        Args:
            limit: Maximum number of transactions to return (default 20)
            offset: Number of transactions to skip from the beginning (default 0)
            category: Optional category filter (case-insensitive)
    
        Returns:
            Dictionary containing total count, pagination info, and transactions with index field
        """
        transactions = _load_transactions()
    
        indexed: List[Dict[str, Any]] = []
        for idx, txn in enumerate(transactions):
            if category and str(txn.get("category", "")).lower() != category.lower():
                continue
            entry = dict(txn)
            entry["index"] = idx
            indexed.append(entry)
    
        total = len(indexed)
        sliced = indexed[offset: offset + limit]
    
        return {
            "total": total,
            "offset": offset,
            "limit": limit,
            "transactions": sliced,
            "has_more": offset + limit < total
        }
  • Helper utility to load the list of transactions from the persistent JSON file, used directly in `list_transactions`.
    def _load_transactions() -> List[Dict[str, Any]]:
        if JSON_FILE.exists():
            with JSON_FILE.open("r") as f:
                try:
                    return json.load(f)
                except json.JSONDecodeError:
                    return []
        return []
  • The `@mcp.tool()` decorator registers the `list_transactions` function as an MCP tool.
    @mcp.tool()
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions pagination and filtering capabilities, which adds useful context beyond basic listing. However, it lacks details on permissions, rate limits, error handling, or whether the operation is read-only (implied by 'List' but not explicitly stated).

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?

The description is well-structured with a brief overview followed by clearly labeled 'Args' and 'Returns' sections. Every sentence adds value: the first sentence states purpose and features, and the subsequent sections efficiently document parameters and return values without redundancy.

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

Completeness4/5

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

Given the tool's moderate complexity (3 parameters, no annotations, but with output schema), the description is fairly complete. It covers purpose, parameters, and return structure. The output schema exists, so the description doesn't need to detail return values, but it could benefit from more behavioral context like error cases or performance notes.

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?

The schema description coverage is 0%, so the description must compensate. It provides clear semantics for all three parameters (limit, offset, category) in the 'Args' section, explaining their purposes and defaults. This adds significant value beyond the bare schema, though it doesn't cover edge cases like format for 'category'.

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

Purpose4/5

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

The description clearly states the verb 'List' and resource 'stored transactions from the JSON ledger', making the purpose specific and understandable. It distinguishes from siblings like 'delete_transactions' (deletion) and 'store_transactions' (storage), though it doesn't explicitly differentiate from 'query_financial_history' which might have overlapping functionality.

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

Usage Guidelines2/5

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

The description mentions 'optional pagination and filtering', which implies usage for retrieving filtered data, but provides no explicit guidance on when to use this tool versus alternatives like 'query_financial_history'. There are no statements about when-not-to-use or prerequisites, leaving usage context vague.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xinrong-meng/my-finance-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server