{
  "name": "MCP Client - SeqBot",
  "nodes": [
    {
      "parameters": {
        "public": true,
        "initialMessages": "Hi there! \ud83d\udc4b\nMy name is SeqBot. How can I assist you today?",
        "options": {
          "title": "SeqBot"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        -720,
        -64
      ],
      "id": "eae485b3-b38f-49b3-9a87-77f163c85c92",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "endpointUrl": "https://tecval.app.n8n.cloud/mcp/e7770090-9193-49e3-a613-f13b1874b952",
        "options": {
          "timeout": 120000
        }
      },
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.1,
      "position": [
        -256,
        192
      ],
      "id": "20332ce9-c630-417e-a1b9-e03234792a22",
      "name": "MCP Client"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{$json.chatInput}}",
        "options": {
          "systemMessage": "Eres un agente que se conecta al MCP Server Trigger, y a las herramientas que tiene disponible.\n\nResponde siempre seg\u00fan la base de datos, nunca respondas informaci\u00f3n que no funciona\nDebes responder en ingles.\n\n{{ $json.chatInput }}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        -512,
        -64
      ],
      "id": "1cfc5db4-f414-43a2-b833-34ff8b78a75d",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4.1-mini",
          "mode": "list",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -640,
        192
      ],
      "id": "a917fbf8-781f-48b8-a4d6-8c3cf62d1048",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -448,
        192
      ],
      "id": "d41f6015-599e-4278-a4cd-03a15e1b8b4c",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "f6f646d1-c36a-489e-b808-79b0bd542b94",
              "leftValue": "={{ $json.message.content.inicio }}",
              "rightValue": "",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              }
            },
            {
              "id": "aa35c305-0002-47d3-b06c-f52599515ae3",
              "leftValue": "={{ $json.message.content.final }}",
              "rightValue": "",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        160,
        -64
      ],
      "id": "0cc0c1aa-d5b4-40a4-b97c-356f8787d2a1",
      "name": "Is it about a biomarker region?"
    },
    {
      "parameters": {
        "url": "=https://api.genome.ucsc.edu/getData/sequence?genome=hg38;chrom={{ $('Analyze the agent response').item.json.message.content.cromosoma }};start={{ $('Analyze the agent response').item.json.message.content.inicio }};end={{ $('Analyze the agent response').item.json.message.content.final }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        416,
        -160
      ],
      "id": "df3ca3a7-c25b-4a8c-b814-d95ae35e8d06",
      "name": "UCSC Genome API"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "let respuesta = $('AI Agent').item.json.output;\n\nconst cantidad = ($json.dna.toUpperCase().match(new RegExp('GCGC', \"g\")) || []).length;\n\nconst index = respuesta.indexOf('\u00bf');\nif(index > 0){\n  respuesta = respuesta.substring(0, index) + '\\n- Sitios GCGC: ' + cantidad + '\\n- Secuencia: ' + $json.dna.toUpperCase()  + '\\n\\n' + respuesta.substring(index);\n} else {\n  respuesta = respuesta  + '\\n- Sitios GCGC: ' + cantidad + '\\n- Secuencia: ' + $json.dna.toUpperCase()  + '\\n\\n' + respuesta.substring(index);\n}\n\nreturn {\n  output: respuesta\n}\n\n\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        -160
      ],
      "id": "6547b3e0-efc0-4ee2-9ef3-bd96979bebdb",
      "name": "Attach the sequence"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "\nreturn {output:$('AI Agent').item.json.output};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        416,
        64
      ],
      "id": "277d9c4b-e406-480d-a267-c8c79b5748fc",
      "name": "Build a response"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "chatgpt-4o-latest",
          "mode": "list",
          "cachedResultName": "CHATGPT-4O-LATEST"
        },
        "messages": {
          "values": [
            {
              "content": "=Analiza el siguiente texto y si meciona region de biomarcadores para un gen especifico extrae del mismo la siguiente informacion Inicio, Fin y Chromosoma y retorna esa respuesta en formato JSON con esta estructura: \n\n{ inicio: <posicion inicial> \n  final: <posicion final>\n  cromosoma: <n\u00famero de cromosoma>  \n}\n{{ $json.output }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        -192,
        -64
      ],
      "id": "154fb4c4-2114-40dd-afa6-ba645989196d",
      "name": "Analyze the agent response",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Analyze the agent response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is it about a biomarker region?": {
      "main": [
        [
          {
            "node": "UCSC Genome API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build a response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "UCSC Genome API": {
      "main": [
        [
          {
            "node": "Attach the sequence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze the agent response": {
      "main": [
        [
          {
            "node": "Is it about a biomarker region?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9f4e8f5b-217e-46cc-8e5b-cbbd8fab1449",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "JPS5Xs2fFYTgwds1",
  "tags": []
}