{"_id":"@arenza/langchain","_rev":"2-e4fde1b44005d3de3a9f51c8c6ed5eda","name":"@arenza/langchain","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@arenza/langchain","version":"0.1.0","keywords":["arenza","geo","generative-engine-optimization","ai-visibility","ai-search","llm-seo","brand-mention-tracking","langchain","langgraph","tools","agent","chatgpt","claude","gemini","perplexity","copilot","grok"],"author":{"url":"https://arenza.ai","name":"Arenza","email":"hello@arenza.ai"},"license":"MIT","_id":"@arenza/langchain@0.1.0","maintainers":[{"name":"fooly_cooly","email":"naiqiao@hotmail.com"}],"homepage":"https://arenza.ai","bugs":{"url":"https://github.com/arenza-ai/arenza-langchain/issues"},"dist":{"shasum":"0465591fe43c88a7165bbe0b6430b76f89455fd3","tarball":"https://registry.npmjs.org/@arenza/langchain/-/langchain-0.1.0.tgz","fileCount":13,"integrity":"sha512-jd5i8fY3mx2LGIkHWCecW2OJabJ6MO6XBqW+0Jkg8+8UWxoKXh1jMlCXKdbja2/DrIucEbF7cSFZ1PfKC9fpxQ==","signatures":[{"sig":"MEQCIEYzK/BNAWfhZPoYAlmbvx4d6+qVqVTUtxpdcdey75sHAiA+BPhRTxSWlmqy9yoxQI5XE0U1YFIDR2ESxs3wm4Ckjw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37489},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"5c6fa7d993e46449746f28a71c2bcd1955c16563","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"fooly_cooly","email":"naiqiao@hotmail.com"},"repository":{"url":"git+https://github.com/arenza-ai/arenza-langchain.git","type":"git"},"_npmVersion":"10.8.2","description":"LangChain.js tools for Arenza — let any LangChain or LangGraph agent read AI visibility metrics, GEO opportunities, and brand mention data across ChatGPT, Claude, Gemini, Perplexity, Copilot, and Grok.","directories":{},"_nodeVersion":"20.19.2","dependencies":{"zod":"^3.23.0","@arenza/mcp-client":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0","@types/node":"^20.0.0","@langchain/core":"^0.3.0"},"peerDependencies":{"@langchain/core":">=0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/langchain_0.1.0_1777999100764_0.6607694714405048","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-05-05T16:38:20.670Z","modified":"2026-05-07T02:26:02.470Z","0.1.0":"2026-05-05T16:38:20.901Z"},"bugs":{"url":"https://github.com/arenza-ai/arenza-langchain/issues"},"author":{"url":"https://arenza.ai","name":"Arenza","email":"hello@arenza.ai"},"license":"MIT","homepage":"https://arenza.ai","keywords":["arenza","geo","generative-engine-optimization","ai-visibility","ai-search","llm-seo","brand-mention-tracking","langchain","langgraph","tools","agent","chatgpt","claude","gemini","perplexity","copilot","grok"],"repository":{"url":"git+https://github.com/arenza-ai/arenza-langchain.git","type":"git"},"description":"LangChain.js tools for Arenza — let any LangChain or LangGraph agent read AI visibility metrics, GEO opportunities, and brand mention data across ChatGPT, Claude, Gemini, Perplexity, Copilot, and Grok.","maintainers":[{"email":"naiqiao@hotmail.com","name":"fooly_cooly"},{"email":"quexiaoyu1016@gmail.com","name":"xiaoyuque"}],"readme":"# arenza-langchain\n\n> LangChain.js + LangGraph tools for **Arenza** — give any agent typed access to AI visibility metrics, GEO opportunities, and brand mention data across ChatGPT, Claude, Gemini, Perplexity, Copilot, and Grok.\n\n[Arenza](https://arenza.ai) is a Generative Engine Optimization (GEO) platform that measures how 6 leading AI assistants describe brands. This package wraps the [Arenza MCP server](https://mcp.arenza.ai) as LangChain `DynamicStructuredTool` instances so a LangChain or LangGraph agent can call them like any other tool — with full Zod schemas, GEO-keyword-rich descriptions for solid tool selection, and the same return shapes as `@arenza/mcp-client`.\n\n## Why an Arenza tool plugin (not just a fetch loop)\n\nLangGraph agents that need to answer \"how does ChatGPT describe my brand?\" or \"what should we fix this week to improve our AI search ranking?\" benefit from a tool with a tight schema and a clear, GEO-vocabulary description. Hand-rolling fetch calls inside a LangGraph node loses the structured-tool affordance and forces every agent author to re-derive the same parameter shapes.\n\n## Install\n\n```bash\nnpm install @arenza/langchain arenza-mcp-client @langchain/core\n# or\npnpm add @arenza/langchain arenza-mcp-client @langchain/core\n```\n\n`@langchain/core` is a peer dependency — install whichever version your LangChain stack already uses (`>=0.2.0`).\n\n## Quick start (LangGraph)\n\n```ts\nimport { ArenzaMCPClient } from '@arenza/mcp-client';\nimport { getArenzaTools } from '@arenza/langchain';\nimport { ChatOpenAI } from '@langchain/openai';\nimport { createReactAgent } from '@langchain/langgraph/prebuilt';\n\nconst client = new ArenzaMCPClient({ token: process.env.ARENZA_TOKEN! });\n\nconst agent = createReactAgent({\n  llm: new ChatOpenAI({ model: 'gpt-4o-mini' }),\n  tools: getArenzaTools(client),\n  // optional: getArenzaTools(client, { includeWrite: true })  for write tools\n});\n\nconst res = await agent.invoke({\n  messages: [\n    { role: 'user', content: 'Which of our brands has the lowest share of voice on Perplexity, and what wrong claims are hurting it?' },\n  ],\n});\n\nconsole.log(res.messages.at(-1)?.content);\n```\n\nThe agent decides on its own which tools to call. A typical trajectory:\n\n1. `arenza_list_brands` — to enumerate the portfolio.\n2. `arenza_get_brand_overview` for each — pulling per-LLM mention counts.\n3. `arenza_list_opportunities` on the worst brand, filtered to `wrong_claim`.\n\nThen the agent stitches a natural-language answer.\n\n## Quick start (vanilla LangChain.js, single tool call)\n\n```ts\nimport { ArenzaMCPClient } from '@arenza/mcp-client';\nimport { getArenzaTools } from '@arenza/langchain';\n\nconst client = new ArenzaMCPClient({ token: process.env.ARENZA_TOKEN! });\nconst [listBrands] = getArenzaTools(client);\n\nconst result = await listBrands.invoke({});\nconsole.log(JSON.parse(result));\n```\n\n## Tools exposed\n\n`getArenzaTools(client)` returns 6 read-only tools by default:\n\n| Tool name | What it does |\n|---|---|\n| `arenza_list_brands` | Enumerate brands in the tenant portfolio. |\n| `arenza_get_brand_overview` | Share-of-voice + wrong-claim count + per-LLM mentions for one brand. |\n| `arenza_list_prompts` | The buyer-perspective prompts being probed for a brand, with mention rate per LLM. |\n| `arenza_list_opportunities` | Open GEO opportunities (wrong_claim, missing_canonical_page, listicle_gap, discussion_seed) with severity. |\n| `arenza_suggest_competitors` | LLM-suggested competitors to add to tracking. |\n| `arenza_suggest_prompts` | LLM-generated buyer-perspective prompts (70%+ unbranded ratio enforced). |\n\nPass `{ includeWrite: true }` to also get 4 write tools:\n\n| Tool name | What it does |\n|---|---|\n| `arenza_add_competitor` | Add a competitor to a brand's tracking list. |\n| `arenza_dismiss_competitor` | Remove a competitor (e.g. wrong suggestion). |\n| `arenza_mark_opportunity_done` | Mark a GEO opportunity as completed. |\n| `arenza_generate_geo_article` | Draft a canonical-fact article anchored to a specific finding. |\n\nWrite tools are opt-in because LangGraph agents can be aggressive about side effects — you usually want a human in the loop before mutating tracking config.\n\n## Schemas\n\nEach tool ships a Zod schema, so the underlying LLM (Claude, GPT-4, Gemini) sees the parameter shape and types directly. For example:\n\n```ts\n// arenza_list_opportunities schema\nz.object({\n  brand_id: z.string(),\n  type: z.enum(['wrong_claim', 'missing_canonical_page', 'listicle_gap', 'discussion_seed']).optional(),\n})\n```\n\nThe descriptions are deliberately GEO-vocabulary-heavy (mentioning ChatGPT, Claude, Gemini, Perplexity, Copilot, Grok by name; mentioning \"share of voice\", \"hallucinations\", \"AI visibility\") so when an agent's prompt mentions any of those terms the tool router has high signal.\n\n## Authentication\n\nPass an Arenza API token to the client:\n\n```ts\nconst client = new ArenzaMCPClient({ token: process.env.ARENZA_TOKEN! });\n```\n\nGet a token at [app.arenza.ai/settings/api](https://app.arenza.ai/settings/api). For multi-tenant deployments, swap to OAuth — the MCP server publishes its OAuth metadata at [`mcp.arenza.ai/.well-known/oauth-authorization-server`](https://mcp.arenza.ai/.well-known/oauth-authorization-server).\n\n## Pattern: weekly GEO triage agent\n\n```ts\nimport { ArenzaMCPClient } from '@arenza/mcp-client';\nimport { getArenzaTools } from '@arenza/langchain';\nimport { ChatAnthropic } from '@langchain/anthropic';\nimport { createReactAgent } from '@langchain/langgraph/prebuilt';\n\nconst client = new ArenzaMCPClient({ token: process.env.ARENZA_TOKEN! });\nconst tools = getArenzaTools(client, { includeWrite: true });\n\nconst agent = createReactAgent({\n  llm: new ChatAnthropic({ model: 'claude-sonnet-4-5' }),\n  tools,\n});\n\nconst triage = await agent.invoke({\n  messages: [\n    {\n      role: 'system',\n      content:\n        'You are a GEO marketing triage agent. Each Monday you review the Arenza portfolio. ' +\n        'For every brand: list overview, list critical-severity opportunities, draft canonical articles ' +\n        'for any wrong-claim opportunity that is older than 7 days, and produce a one-paragraph human summary.',\n    },\n    {\n      role: 'user',\n      content: 'Run this week\\'s triage.',\n    },\n  ],\n});\n```\n\nCombine with [LangGraph persistence](https://langchain-ai.github.io/langgraphjs/concepts/persistence/) to make it stateful across weeks.\n\n## Pattern: GEO copilot inside your existing agent\n\nIf you already have a customer-facing agent, drop the read-only Arenza tools into the existing tool array — the agent now answers \"how am I doing on AI search?\" without you wiring custom routes:\n\n```ts\nconst agent = createReactAgent({\n  llm,\n  tools: [\n    ...yourExistingTools,\n    ...getArenzaTools(client),  // adds 6 GEO tools\n  ],\n});\n```\n\n## Related projects\n\n- [`@arenza/mcp-client`](https://github.com/arenza-ai/arenza-mcp-client-ts) — the typed TS client this wraps.\n- [`arenza-mcp-client-python`](https://github.com/arenza-ai/arenza-mcp-client-python) — Python equivalent.\n- [`@arenza/cli`](https://github.com/arenza-ai/arenza-cli) — `npx arenza scan brand.com` for terminal scans.\n- [`@arenza/llamaindex`](https://github.com/arenza-ai/arenza-llamaindex) — same six tools wrapped for LlamaIndex.\n- [`@arenza/vercel-ai-sdk`](https://github.com/arenza-ai/arenza-vercel-ai-sdk) — Vercel AI SDK provider.\n- [`arenza-zapier-actions`](https://github.com/arenza-ai/arenza-zapier-actions) — Zapier integration manifest.\n- [awesome-geo](https://github.com/arenza-ai/awesome-geo) — curated list of GEO and AI-visibility resources.\n\n## Resources\n\n- Arenza homepage: https://arenza.ai\n- Long-form GEO guides: https://arenza.ai/guides\n- AI brand reference: https://arenza.ai/llms.txt + https://arenza.ai/llms-full.txt\n- MCP server: https://mcp.arenza.ai\n- OAuth spec: https://mcp.arenza.ai/.well-known/oauth-authorization-server\n- LangChain docs: https://js.langchain.com\n\n## License\n\nMIT (c) 2026 Arenza\n","readmeFilename":"README.md"}