{
  "id": "VjYVuVxMuX9MbtGy",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "MCP Personal Expense",
  "tags": [],
  "nodes": [
    {
      "id": "544866c7-9676-4a94-a77d-8637b8b9f6e3",
      "name": "MCP Server Trigger",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "position": [
        -1560,
        360
      ],
      "parameters": {
        "path": "personal-expense"
      },
      "typeVersion": 1
    },
    {
      "id": "f45e1509-487b-46c6-b7dd-224df465c981",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        1360,
        -340
      ],
      "parameters": {
        "options": {
          "ignoreCase": true
        },
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c804feba-d6da-43d9-88a9-24dfa0f7a2ed",
              "operator": {
                "type": "dateTime",
                "operation": "afterOrEquals"
              },
              "leftValue": "={{ $json.date }}",
              "rightValue": "={{ $('Switch').item.json.payload.dateStart }}"
            },
            {
              "id": "512eb3ab-f42d-4a35-bc0e-7ff67ab0d6a5",
              "operator": {
                "type": "dateTime",
                "operation": "beforeOrEquals"
              },
              "leftValue": "={{ $json.date }}",
              "rightValue": "={{ $('Switch').item.json.payload.dateEnd }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f4411283-0efa-4218-8d96-9d9a1c7c19e6",
      "name": "Google Sheets Filter Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -40,
        420
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "function"
            },
            {
              "name": "payload",
              "type": "object"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "827737c1-4466-499c-abae-bc2e03d9191a",
      "name": "Get list transactions",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -1880,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Get Transactions",
        "workflowInputs": {
          "value": {
            "payload": "={\n  \"dateStart\": \"{{ $fromAI(\"dateStart\", \"Date Start. Format: YYYY-MM-DD\", \"string\") }}\",\n  \"dateEnd\": \"{{ $fromAI(\"dateEnd\", \"Date End. Format: YYYY-MM-Dd\", \"string\") }}\"\n}",
            "function": "list_transaction"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "afb64fd3-d554-4f4f-9447-3a5cd48bae1a",
      "name": "Get By ID",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -1740,
        560
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values0_Value', ``, 'string') }}",
              "lookupColumn": "id"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "descriptionType": "manual",
        "toolDescription": "Get Data by ID"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "05b35a22-757d-411f-ad56-a1b0e3d7a695",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        380,
        320
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "list_transaction",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3e9f8105-2bd7-4571-8909-86cddbf4e3eb",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "list_transaction"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "remove_transaction",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8bba675d-4f2f-411d-858e-cd0573f2a0d7",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "remove_transaction"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "add_transaction",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1cf7fe89-f22e-4656-9e16-570f4b7088f0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "add_transaction"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "update_transaction",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f63ece2b-a821-4e79-8797-365fe6b6ce2b",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "update_transaction"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "add_budget",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "411a0ece-ac3a-49fe-b357-c7dc56f21042",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "add_budget"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "update_budget",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8bac74de-c55c-4248-a2a7-728d8acae09a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "update_budget"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "remove_budget",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "818c0b7b-c1b0-4150-b683-76287f0fd1f8",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "remove_budget"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "get_budget",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "579f8f4d-7ce0-46cf-aee5-290d5025f071",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.function }}",
                    "rightValue": "get_budget"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "e7ac76ec-a796-429a-85d0-44490cfe4f00",
      "name": "get by id",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        100
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.payload.id }}",
              "lookupColumn": "id"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "d7ea9a2f-b9ef-4a02-92f7-25ec2c3a9232",
      "name": "remove transaction",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1160,
        100
      ],
      "parameters": {
        "operation": "delete",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "startIndex": "={{ $json.row_number }}"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "f6fe072a-ef50-4f95-87a6-e7b0e047127e",
      "name": "get all transactions",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        -200
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "7af5ea63-d59b-49e6-9a42-c5e85ec4650e",
      "name": "Remove Transaction",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -1600,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Remove Transaction",
        "workflowInputs": {
          "value": {
            "payload": "={\n  \"id\": \"{{ $fromAI(\"id\", \"ID\", \"string\") }}\"\n}",
            "function": "remove_transaction"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e8c38268-0876-461a-8b89-ed121c321d4a",
      "name": "Crypto",
      "type": "n8n-nodes-base.crypto",
      "position": [
        880,
        520
      ],
      "parameters": {
        "action": "generate",
        "dataPropertyName": "id"
      },
      "typeVersion": 1
    },
    {
      "id": "ed85ffef-9a72-4025-a0e6-7f57eb9c4a0a",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1280,
        520
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4e34ce93-3976-4f74-8933-32bc34bc459c",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.type }}",
              "rightValue": "expense"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "085c44bd-dfbc-4a37-9f47-c9562e54b699",
      "name": "Get existing budget",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1480,
        500
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.date.substring(0, 7) }}",
              "lookupColumn": "month"
            },
            {
              "lookupValue": "={{ $json.category }}",
              "lookupColumn": "category"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "7e6e1808-4b96-42a0-a696-5ef7a5b1fc6e",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1900,
        320
      ],
      "parameters": {
        "jsCode": "\n\nreturn {\n  \"id\": $(\"add transaction\").first().json.id,\n  \"budget\": {},\n  \"task\": \"Ask user to add monthly budget\"\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "4fe6970d-d46c-42c1-aa32-c5fa9a1f6b80",
      "name": "add transaction",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1080,
        520
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.id }}",
            "date": "={{ $json.payload.date }}",
            "type": "={{ $json.payload.type }}",
            "month": "={{ $json.payload.date.substring(0,7) }}",
            "amount": "={{ $json.payload.amount }}",
            "purpose": "={{ $json.payload.purpose }}",
            "category": "={{ $json.payload.category }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purpose",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "purpose",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "month",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "month",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "e97f4b19-6d86-4c73-8d64-356c5a6f33fe",
      "name": "budget not found?",
      "type": "n8n-nodes-base.if",
      "position": [
        1660,
        500
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d062f954-0a17-4870-b632-aebea115dad9",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "dcebec66-c750-4e64-8974-d659de8c0943",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        2140,
        520
      ],
      "parameters": {
        "jsCode": "let totalExpenses = 0;\n\nfor (const item of $('Get Monthly Expenses').all()) {\n  totalExpenses += item.json.amount  \n}\n\nlet result = {\n  \"id\": $('add transaction').first().json.id,\n  \"budget\": {\n    \"monthlyLimit\": $('Get existing budget').first().json.budget,\n    \"remainingLimit\": $('Get existing budget').first().json.budget - totalExpenses\n  },\n  \"task\": \"\"\n}\n\nif (totalExpenses > $('Get existing budget').first().json.budget) {\n  result.task = \"Give warning to user or suggest to adjust the budget\"\n}\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "9164bfe3-1549-4943-a489-c67da1d32d9d",
      "name": "Get Monthly Expenses",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1900,
        520
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.month }}",
              "lookupColumn": "month"
            },
            {
              "lookupValue": "={{ $json.category }}",
              "lookupColumn": "category"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "ff8d7da3-c567-41f8-af20-88c3248822bb",
      "name": "Add Transaction",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -1440,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Add Transaction",
        "workflowInputs": {
          "value": {
            "payload": "={   \n  \"date\": \"{{ $fromAI(\"date\", \"Transaction date. Format: YYYY-MM-DD\", \"string\") }}\",   \n  \"purpose\": \"{{ $fromAI(\"purpose\", \"Purpose of the transaction\", \"string\") }}\", \n  \"category\": \"{{ $fromAI(\"category\", \"Transaction category\", \"string\") }}\",\n  \"amount\": {{ $fromAI(\"amount\", \"Transaction amount\", \"number\") }}, \n  \"type\": \"{{ $fromAI(\"type\", \"Transaction type. Can be expense or income\", \"string\") }}\"\n}",
            "function": "add_transaction"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e71da569-0165-4c3f-917a-b97843aba5bf",
      "name": "Code2",
      "type": "n8n-nodes-base.code",
      "position": [
        1500,
        700
      ],
      "parameters": {
        "jsCode": "\nreturn {\n  \"id\": $('add transaction').first().json.id,\n  \"budget\": {},\n  \"task\": \"Congratulate user for new income.\"\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "f601629b-975a-48ba-a832-f53003776246",
      "name": "Update transaction",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        900,
        1020
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.payload.id }}",
            "date": "={{ $json.payload.date }}",
            "type": "={{ $json.payload.type }}",
            "month": "={{ $json.payload.date.substring(0,7) }}",
            "amount": "={{ $json.payload.amount }}",
            "purpose": "={{ $json.payload.purpose }}",
            "category": "={{ $json.payload.category }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "purpose",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "purpose",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "month",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "month",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "0bd3eebb-e341-49cc-87d3-c5ba6fe73da6",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        1040
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4e34ce93-3976-4f74-8933-32bc34bc459c",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Update transaction').item.json.type }}",
              "rightValue": "expense"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c82171bf-fae5-4407-9af3-c9abddff0b04",
      "name": "Code3",
      "type": "n8n-nodes-base.code",
      "position": [
        1840,
        880
      ],
      "parameters": {
        "jsCode": "\n\nreturn {\n  \"id\": $(\"Update transaction\").first().json.id,\n  \"budget\": {},\n  \"task\": \"Ask user to add monthly budget\"\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "740cbba3-76e5-42a4-b8c8-1a33f137a576",
      "name": "budget not found?1",
      "type": "n8n-nodes-base.if",
      "position": [
        1600,
        1040
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d062f954-0a17-4870-b632-aebea115dad9",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d297855a-d70d-43cb-83d6-df2e712698d8",
      "name": "Code4",
      "type": "n8n-nodes-base.code",
      "position": [
        2080,
        1060
      ],
      "parameters": {
        "jsCode": "let totalExpenses = 0;\n\nfor (const item of $('Get Monthly Expenses1').all()) {\n  totalExpenses += item.json.amount  \n}\n\nlet result = {\n  \"id\": $('Update transaction').first().json.id,\n  \"budget\": {\n    \"monthlyLimit\": $('Get existing budget2').first().json.budget,\n    \"remainingLimit\": $('Get existing budget2').first().json.budget - totalExpenses\n  },\n  \"task\": \"\"\n}\n\nif (totalExpenses > $('Get existing budget2').first().json.budget) {\n  result.task = \"Give warning to user or suggest to adjust the budget\"\n}\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "3369be8c-67cc-4b2d-9c04-fb712afa6509",
      "name": "Get Monthly Expenses1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1840,
        1060
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.month }}",
              "lookupColumn": "month"
            },
            {
              "lookupValue": "={{ $json.category }}",
              "lookupColumn": "category"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "4ae8401e-0ad5-43b4-aa72-b04edc150d4d",
      "name": "Code5",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        1240
      ],
      "parameters": {
        "jsCode": "\nreturn {\n  \"id\": $('add transaction').first().json.id,\n  \"budget\": {},\n  \"task\": \"Congratulate user for new income.\"\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "ebcd4517-f735-4378-8c25-1b48e4593808",
      "name": "Get Existing Budget",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        920,
        1500
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.payload.category }}",
              "lookupColumn": "category"
            },
            {
              "lookupValue": "={{ $json.payload.month }}",
              "lookupColumn": "month"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "76132552-d70d-46dd-add6-39436430699f",
      "name": "Get existing budget2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1420,
        1040
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.date.substring(0, 7) }}",
              "lookupColumn": "month"
            },
            {
              "lookupValue": "={{ $json.category }}",
              "lookupColumn": "category"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "4d91a329-61d5-4ceb-a51a-27278c9112ad",
      "name": "Add budget",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1440,
        1480
      ],
      "parameters": {
        "columns": {
          "value": {
            "month": "={{ $('Switch').item.json.payload.month }}",
            "budget": "={{ $('Switch').item.json.payload.amount }}",
            "category": "={{ $('Switch').item.json.payload.category }}"
          },
          "schema": [
            {
              "id": "month",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "month",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "budget",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "83c5093e-fa10-4bcc-b684-e5bd22fdfd00",
      "name": "Code6",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        1680
      ],
      "parameters": {
        "jsCode": "\n\nreturn {\n  \"task\": \"Budget already exists. Ask user to update it instead.\"\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "f83089ee-33de-48a0-8440-f02988ddd736",
      "name": "Get Existing Budget1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        940,
        1960
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.payload.month }}",
              "lookupColumn": "month"
            },
            {
              "lookupValue": "={{ $json.payload.category }}",
              "lookupColumn": "category"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "84bcedda-5a53-4dbe-a2d9-811f96f13fd6",
      "name": "Code7",
      "type": "n8n-nodes-base.code",
      "position": [
        1360,
        1940
      ],
      "parameters": {
        "jsCode": "\n\nreturn {\n  \"task\": \"Budget not found. Ask user to add budget instead.\"\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "d761eb69-7f8d-4f7a-9f16-f06a863fa2a6",
      "name": "Update Budget",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1360,
        2120
      ],
      "parameters": {
        "columns": {
          "value": {
            "month": "={{ $('Switch').item.json.payload.month }}",
            "budget": "={{ $('Switch').item.json.payload.amount }}",
            "category": "={{ $('Switch').item.json.payload.category }}",
            "row_number": "={{ $json.row_number }}"
          },
          "schema": [
            {
              "id": "month",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "month",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "budget",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "1ea98857-1eac-4135-87b9-be5b89df0a0f",
      "name": "Get Existing Budget2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        940,
        2420
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.payload.category }}",
              "lookupColumn": "category"
            },
            {
              "lookupValue": "={{ $json.payload.month }}",
              "lookupColumn": "month"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "2c3cc9d2-2001-4698-9529-1373c43bebef",
      "name": "budget not found?4",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        2420
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d062f954-0a17-4870-b632-aebea115dad9",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "32259e82-ea9f-475f-9b5d-609e1bc63595",
      "name": "Code8",
      "type": "n8n-nodes-base.code",
      "position": [
        1360,
        2400
      ],
      "parameters": {
        "jsCode": "\n\nreturn {\n  \"task\": \"Budget not found, nothing to remove.\"\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "d5f55296-427e-4525-b71a-7015b89b9215",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2580,
        260
      ],
      "parameters": {
        "width": 2040,
        "height": 540,
        "content": "## MCP Main tools\n\nThis is an MCP main entry point. \nIt has several tools that are available to use by AI client.\n\nMost of the tools will execute another workflow\n\n\n### How to use\n\n* You need to be able to sign in via google in order to use google sheets node. \n  Refer to this [documentation](https://docs.n8n.io/integrations/builtin/credentials/google/) on how to sign in with google.\n* Copy this [google sheet template](https://docs.google.com/spreadsheets/d/1XzoYEZflj1Rdo2MVKosRqXHSjkazE5vuwYWHLybX4b0/edit?usp=sharing)\n* after you copy the sheet, make sure you enable sharing with everyone who has the link\n* In each google sheet nodes, change `document` source to `By URL`, paste the link in the URL field\n* For the nodes that related to transaction, change the `sheet` target to `transactions`\n* For the nodes that related to budget, change the `sheet` target to `budgets`"
      },
      "typeVersion": 1
    },
    {
      "id": "605dcb3d-1bd9-403a-b50a-75ffdb755c0a",
      "name": "Update Transaction",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -1280,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Update Transaction",
        "workflowInputs": {
          "value": {
            "payload": "={   \n  \"id\": \"{{ $fromAI(\"id\", \"UUID of the transaction.\", \"string\") }}\",\n  \"date\": \"{{ $fromAI(\"date\", \"Transaction date. Format: YYYY-MM-DD\", \"string\") }}\",   \n  \"purpose\": \"{{ $fromAI(\"purpose\", \"Purpose of the transaction\", \"string\") }}\", \n  \"category\": \"{{ $fromAI(\"category\", \"Transaction category\", \"string\") }}\",\n  \"amount\": {{ $fromAI(\"amount\", \"Transaction amount\", \"number\") }}, \n  \"type\": \"{{ $fromAI(\"type\", \"Transaction type. Can be expense or income\", \"string\") }}\"\n}",
            "function": "update_transaction"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "65352e90-d0b3-4a93-94bc-a31e32efb6ea",
      "name": "Add Budget",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -1120,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Add monthly budget",
        "workflowInputs": {
          "value": {
            "payload": "={   \n  \"month\": \"{{ $fromAI(\"month\", \"Budget month. Format : YYYY-MM\", \"string\") }}\",\n  \"category\": \"{{ $fromAI(\"category\", \"Budget category\", \"string\") }}\",   \n  \"amount\": {{ $fromAI(\"amount\", \"Budget amount\", \"number\") }}\n}",
            "function": "add_budget"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6c1666ec-7ebd-4f61-98db-06dc6c892892",
      "name": "Update Budget Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -980,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Update monthly budget",
        "workflowInputs": {
          "value": {
            "payload": "={   \n  \"month\": \"{{ $fromAI(\"month\", \"Budget month. Format : YYYY-MM\", \"string\") }}\",\n  \"category\": \"{{ $fromAI(\"category\", \"Budget category\", \"string\") }}\",   \n  \"amount\": {{ $fromAI(\"amount\", \"Budget amount\", \"number\") }}\n}",
            "function": "update_budget"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2544655e-d5fd-476f-9185-5fe67f28b425",
      "name": "Remove Budget",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -820,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Remove Budget",
        "workflowInputs": {
          "value": {
            "payload": "={   \n  \"month\": \"{{ $fromAI(\"month\", \"Budget month. Format : YYYY-MM\", \"string\") }}\",\n  \"category\": \"{{ $fromAI(\"category\", \"Budget category\", \"string\") }}\"\n}",
            "function": "remove_budget"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "021e523b-c47f-4b06-9104-279e7013df6b",
      "name": "Execution Data",
      "type": "n8n-nodes-base.executionData",
      "position": [
        180,
        420
      ],
      "parameters": {
        "dataToSave": {
          "values": [
            {
              "key": "function",
              "value": "={{ $('Google Sheets Filter Workflow').item.json.function }}"
            },
            {
              "key": "payload",
              "value": "={{ JSON.stringify($('Google Sheets Filter Workflow').item.json.payload) }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dc42a268-4b4d-46a2-9caa-04400bccfbbc",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        -420
      ],
      "parameters": {
        "color": 6,
        "width": 580,
        "height": 180,
        "content": "### Get all transaction\n\nIt will get list of transactions. \n\nSince currently google sheets integration doesn't support date range filter, so if the start date and end date criterial fall into same month it will get data by filtering helper column `month`. But if they're different month, then it get all transactions"
      },
      "typeVersion": 1
    },
    {
      "id": "acaaf56e-62c6-4b08-a7dc-2837fe153229",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        840,
        -360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7fc9f6b2-f43e-41da-b3cb-969c70ac3b46",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.payload.dateStart.substring(0,7) }}",
              "rightValue": "={{ $json.payload.dateEnd.substring(0,7) }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "31a41bd8-f14f-45a0-8611-5a778b502312",
      "name": "get all transactions1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        -480
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.payload.dateStart.substring(0,7) }}",
              "lookupColumn": "month"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "transactions"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "7e99365b-555e-470d-bad1-1a406ba20a15",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1400,
        40
      ],
      "parameters": {
        "color": 6,
        "width": 320,
        "height": 180,
        "content": "### Remove transaction\n\nIt will remove transaction by ID. However we need to get the transaction first before removing to get row number. Because removing transaction needs a row number, can't be filtered by anything"
      },
      "typeVersion": 1
    },
    {
      "id": "b470904a-69db-4e88-9656-ccc736114c87",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2380,
        480
      ],
      "parameters": {
        "color": 6,
        "width": 500,
        "height": 200,
        "content": "### Add transaction\n\nIt will add transaction to a new row. In this workflow it will also check for the existing budget.\n\nIn the response, it has `task` field that will tell AI client what to do next. Either it will suggest user to add budget, or give warning if the budget already reached or surpassed."
      },
      "typeVersion": 1
    },
    {
      "id": "4ddd4f34-be88-40f9-bfbc-84c3707f485d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2380,
        1020
      ],
      "parameters": {
        "color": 6,
        "width": 540,
        "height": 200,
        "content": "### Update transaction\n\nIt will update transaction by ID. In this workflow it will also check for the existing budget.\n\nIt has the same checking budget workflow with the add transaction. I have to duplicate it since in the end it needs to ID from the different previous node. Currently n8n doesn't allow check return value from the node that has not been executed."
      },
      "typeVersion": 1
    },
    {
      "id": "4fe2b09d-ece3-4686-a3bd-8e80800957d0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1700,
        1460
      ],
      "parameters": {
        "color": 6,
        "width": 340,
        "height": 280,
        "content": "### Add monthly budget\n\nIt will add monthly budget.\n\n#### pro tip :\nYou can ask AI client to add budget for several months by prompting such \n\n```\nAdd budget for fashion for this month until the end of the year, $500 per month\n```"
      },
      "typeVersion": 1
    },
    {
      "id": "8e7b0528-61e7-43cb-941c-28cd4dd6e423",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        2020
      ],
      "parameters": {
        "color": 6,
        "width": 260,
        "height": 120,
        "content": "### update monthly budget\n\nIt will update budget"
      },
      "typeVersion": 1
    },
    {
      "id": "7da84021-9af7-496e-8089-ac2237beba24",
      "name": "budget not found?2",
      "type": "n8n-nodes-base.if",
      "position": [
        1140,
        1500
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d062f954-0a17-4870-b632-aebea115dad9",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b6c0e7ff-92b8-43cf-b037-8adfa2b07a05",
      "name": "budget not found?3",
      "type": "n8n-nodes-base.if",
      "position": [
        1140,
        1960
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d062f954-0a17-4870-b632-aebea115dad9",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "dd3206eb-134c-44a2-bcd2-08bd28c408de",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        2460
      ],
      "parameters": {
        "color": 6,
        "width": 260,
        "height": 120,
        "content": "### Remove budget\n\nIt will remove existing budget"
      },
      "typeVersion": 1
    },
    {
      "id": "cb4aae48-7fa0-42ca-8052-441758d8775c",
      "name": "Remove budget",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1360,
        2580
      ],
      "parameters": {
        "operation": "delete",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "startIndex": "={{ $json.row_number }}"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "bb0b7988-c13c-47e7-be28-2e3fc942e566",
      "name": "Get Existing Budget3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        960,
        2840
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.payload.category }}",
              "lookupColumn": "category"
            },
            {
              "lookupValue": "={{ $json.payload.month }}",
              "lookupColumn": "month"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1146268703,
          "cachedResultUrl": "",
          "cachedResultName": "budgets"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "bca9ba8a-9d65-4d85-bfbb-8fcb71a73dce",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        2840
      ],
      "parameters": {
        "color": 6,
        "width": 260,
        "height": 120,
        "content": "### Get existing budget\n\nIt will get existing budget"
      },
      "typeVersion": 1
    },
    {
      "id": "bce1c72b-a5e8-415b-8c26-b15405da7d9f",
      "name": "Get Budget",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -680,
        560
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "VjYVuVxMuX9MbtGy",
          "cachedResultName": "MCP Personal Expense"
        },
        "description": "Get Budget",
        "workflowInputs": {
          "value": {
            "payload": "={      \"month\": \"{{ $fromAI(\"month\", \"Budget month. Format : YYYY-MM\", \"string\") }}\",   \"category\": \"{{ $fromAI(\"category\", \"Budget category\", \"string\") }}\" }",
            "function": "get_budget"
          },
          "schema": [
            {
              "id": "function",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "function",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payload",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "payload",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f4485275-c028-4888-90bd-414d488e0a74",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2580,
        60
      ],
      "parameters": {
        "color": 4,
        "width": 420,
        "content": "# MCP Personal Expense\n\nThis is a template for MCP that has tools to manage personal expenses and budget"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f79633ea-5057-4b65-b41e-4dbb80470657",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get existing budget",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Get existing budget2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "get all transactions1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "get all transactions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "add transaction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        []
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "get by id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update transaction",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Existing Budget",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Existing Budget1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Existing Budget2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Existing Budget3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get By ID": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get by id": {
      "main": [
        [
          {
            "node": "remove transaction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Budget": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Add budget": {
      "main": [
        []
      ]
    },
    "Get Budget": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Remove Budget": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Execution Data": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Transaction": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "add transaction": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "budget not found?": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Monthly Expenses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Transaction": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update Budget Tool": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update Transaction": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update transaction": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "budget not found?1": {
      "main": [
        [
          {
            "node": "Code3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Monthly Expenses1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "budget not found?2": {
      "main": [
        [
          {
            "node": "Add budget",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "budget not found?3": {
      "main": [
        [
          {
            "node": "Code7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Budget",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "budget not found?4": {
      "main": [
        [
          {
            "node": "Code8",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Remove budget",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Budget": {
      "main": [
        [
          {
            "node": "budget not found?2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get existing budget": {
      "main": [
        [
          {
            "node": "budget not found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Budget1": {
      "main": [
        [
          {
            "node": "budget not found?3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Budget2": {
      "main": [
        [
          {
            "node": "budget not found?4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Monthly Expenses": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get existing budget2": {
      "main": [
        [
          {
            "node": "budget not found?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get all transactions": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Monthly Expenses1": {
      "main": [
        [
          {
            "node": "Code4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get list transactions": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get all transactions1": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Filter Workflow": {
      "main": [
        [
          {
            "node": "Execution Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}