Skip to main content
Glama
xinrong-meng

My Finance MCP Server

query_financial_history

Search stored financial transactions using natural language queries to find relevant records and generate summaries with totals.

Instructions

Search through all stored financial data using semantic search.

Args:
    query: Search query string to find relevant transactions

Returns:
    Formatted summary of matching transactions with totals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'query_financial_history' tool. It uses ChromaDB to perform semantic search on stored transactions based on the query, formats the results into a summary including total amount and recent transactions.
    @mcp.tool()
    def query_financial_history(query: str) -> str:
        """
        Search through all stored financial data using semantic search.
        
        Args:
            query: Search query string to find relevant transactions
        
        Returns:
            Formatted summary of matching transactions with totals
        """
        # Search ChromaDB
        results = collection.query(
            query_texts=[query],
            n_results=10
        )
        
        # Format results
        found_transactions = []
        if results['metadatas'][0]:
            for metadata in results['metadatas'][0]:
                found_transactions.append(metadata)
        
        # Create summary
        if found_transactions:
            df = pd.DataFrame(found_transactions)
            total_amount = df['amount'].sum() if 'amount' in df.columns else 0
            count = len(found_transactions)
            
            response = f"Found {count} relevant transactions.\n"
            response += f"Total amount: ${total_amount:.2f}\n\n"
            response += "Recent transactions:\n"
            
            for txn in found_transactions[:5]:
                response += f"- {txn.get('date')}: ${txn.get('amount'):.2f} - {txn.get('description')}\n"
                
        else:
            response = "No matching transactions found."
        
        return response

Tool Definition Quality

Score is being calculated. Check back soon.

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