categorize_transaction
Automatically categorize transactions by analyzing amount, description, and type using AI to simplify financial management for Norman Finance users.
Instructions
Detect category for a transaction using AI.
Args:
transaction_amount: Amount of the transaction
transaction_description: Description of the transaction
transaction_type: Type of transaction ("income" or "expense")
Returns:
Suggested category information for the transaction
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| transaction_amount | Yes | ||
| transaction_description | Yes | ||
| transaction_type | Yes |
Implementation Reference
- norman_mcp/tools/transactions.py:196-227 (handler)The main implementation of the 'categorize_transaction' tool handler, including input schema via Pydantic Field and the logic to call the detect-category API endpoint.@mcp.tool() async def categorize_transaction( ctx: Context, transaction_amount: float = Field(description="Amount of the transaction"), transaction_description: str = Field(description="Description of the transaction"), transaction_type: str = Field(description="Type of transaction (income or expense)") ) -> Dict[str, Any]: """ Detect category for a transaction using AI. Args: transaction_amount: Amount of the transaction transaction_description: Description of the transaction transaction_type: Type of transaction ("income" or "expense") Returns: Suggested category information for the transaction """ api = ctx.request_context.lifespan_context["api"] detect_url = urljoin( config.api_base_url, "api/v1/assistant/detect-category/" ) request_data = { "transaction_amount": transaction_amount, "transaction_description": transaction_description, "transaction_type": transaction_type } return api._make_request("POST", detect_url, json_data=request_data)
- norman_mcp/server.py:328-335 (registration)Registration block in the MCP server setup where register_transaction_tools(server) is called, which registers the categorize_transaction tool among others.register_client_tools(server) register_invoice_tools(server) register_tax_tools(server) register_transaction_tools(server) register_document_tools(server) register_company_tools(server) register_prompts(server) register_resources(server)
- norman_mcp/server.py:19-19 (registration)Import of register_transaction_tools function used to register the transaction tools including categorize_transaction.from norman_mcp.tools.transactions import register_transaction_tools