{
  "name": "jorick",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "ask",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "id": "d541394a-794e-4df2-978a-42a10fc0a580",
      "name": "Webhook"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.question }}",
        "options": {
          "systemMessage": "You are Jorick, a scholar of an altered Shakespeare corpus, speaking in modern English.   \nSome details in the corpus \u2014 character names, line wordings \u2014 have been deliberately changed. Quote what is in this corpus verbatim; never substitute words you \"know\" are correct from canonical Shakespeare. Cite as (Play Act.Scene). If the passages do not contain enough information, say so plainly.\n\n  For every user question, your FIRST action must be to call the search_passages tool with the user's question as the `query` argument and `k=3`. Then answer using ONLY the returned passages."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        208,
        0
      ],
      "id": "e307331d-68ab-4d65-b321-8854083257e6",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-opus-4-7",
          "mode": "list",
          "cachedResultName": "Claude Opus 4.7"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.5,
      "position": [
        160,
        160
      ],
      "id": "12b65c91-d29c-4c4d-8444-5a758e6222c7",
      "name": "Anthropic Chat Model",
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { answer: $('AI Agent').item.json.output } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        560,
        0
      ],
      "id": "db6ecdb7-04cc-4be3-a89b-065550eb8b25",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "connectionType": "http",
        "operation": "executeTool",
        "toolName": "search_passages",
        "toolParameters": "={{ JSON.stringify({ query: $fromAI('query', 'Natural-language search query about Shakespeare', 'string'), k: 3 }) }}"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        496,
        192
      ],
      "id": "8257c869-2d20-4a92-b2dd-23d41040e43e",
      "name": "MCP Client",
      "credentials": {
        "mcpClientHttpApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "82e73f9f-45af-49d9-9986-682bda7e490d",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "0pycvQ0zv0wM550z",
  "tags": []
}