Skip to main content
Glama
SannketNikam

Demo MCP Server

by SannketNikam

summarize

Summarize expenses by category within a specified date range to analyze spending patterns and track financial data.

Instructions

Summarize expenses by category within an inclusive date range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYes
end_dateYes
categoryNo

Implementation Reference

  • main.py:78-99 (handler)
    The main handler function for the 'summarize' MCP tool. It queries the SQLite database for expenses between start_date and end_date, optionally filtered by category, groups by category, computes total amount and count per category, and returns the results as a list of dictionaries.
    async def summarize(start_date, end_date, category=None): # Changed: added async '''Summarize expenses by category within an inclusive date range.''' try: async with aiosqlite.connect(DB_PATH) as c: # Changed: added async query = """ SELECT category, SUM(amount) AS total_amount, COUNT(*) as count FROM expenses WHERE date BETWEEN ? AND ? """ params = [start_date, end_date] if category: query += " AND category = ?" params.append(category) query += " GROUP BY category ORDER BY total_amount DESC" cur = await c.execute(query, params) # Changed: added await cols = [d[0] for d in cur.description] return [dict(zip(cols, r)) for r in await cur.fetchall()] # Changed: added await except Exception as e: return {"status": "error", "message": f"Error summarizing expenses: {str(e)}"}
  • main.py:77-77 (registration)
    The @mcp.tool() decorator registers the subsequent 'summarize' function as an MCP tool with FastMCP.
    @mcp.tool()
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/SannketNikam/test-remote-mcp-server'

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