> ## Documentation Index
> Fetch the complete documentation index at: https://firecrawl-locadex-parallel-t9n-main-ydzk9zxoc20klj1uk5u1gd5b.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Alexandria

> 面向超级智能的知识库

<AlexandriaJourney />

Alexandria 让代理通过 Firecrawl 访问结构化数据。发现工具、查看其输入参数，然后运行。发现工具免费；执行则会消耗工具上标注的额度。

[浏览提供商](https://www.firecrawl.dev/app/alexandria) · [管理提供商条款](https://www.firecrawl.dev/app/settings?tab=data-sources)

<h2 id="built-for-agents">
  为代理而生
</h2>

安装 [CLI](/zh/sdks/cli) 或连接 [MCP server](/zh/mcp-server)。

<Tabs>
  <Tab title="Firecrawl CLI">
    ```bash theme={null}
    # 在网页结果之外同时查找工具。
    firecrawl search "podcast conversations about AI agents" --sources web,alexandria --domain-tools --limit 2

    # 查看输入参数与定价。
    firecrawl find-tools --providers particle --level tools --expand options,response

    # 运行该工具。
    firecrawl scrape particle/podcasts/episodes/search --options '{"keyword_search":"AI agents","limit":2}'
    ```

    使用 `npm install -g firecrawl-cli` 安装，并通过 `firecrawl login` 登录。
  </Tab>

  <Tab title="MCP">
    向你的代理提问：“找到 Particle 的播客工具，查看剧集搜索的输入参数与定价，然后找出关于 AI 代理的对话。”

    该代理会用 `firecrawl_search` 发现工具，用 `firecrawl_find_tools` 查看工具详情，再用 `firecrawl_scrape` 执行工具。
  </Tab>
</Tabs>

<h2 id="use-it-from-the-sdks-and-api">
  通过 SDKs 和 API 使用
</h2>

<Steps>
  <Step title="找到合适的工具">
    描述你的需求，Alexandria 会在返回网页结果的同时给出相关工具。

    <CodeGroup>
      ```javascript JavaScript theme={null}
      const result = await firecrawl.search(
        "podcast conversations about AI agents",
        {
          sources: ["web", "alexandria"],
          limit: 2,
        },
      );
      ```

      ```python Python theme={null}
      result = firecrawl.search(
          "podcast conversations about AI agents",
          sources=["web", "alexandria"],
          limit=2,
      )
      ```

      ```bash cURL theme={null}
      curl https://api.firecrawl.dev/v2/search \
        -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
        "query": "podcast conversations about AI agents",
        "sources": [
          "web",
          "alexandria"
        ],
        "limit": 2
      }'
      ```
    </CodeGroup>

    结果中包含 `web` 页面和已排序的 `tools`。每个工具都会给出其提供商、功能、输入参数、响应约定和执行价格。
  </Step>

  <Step title="确认工具的调用要求">
    调用前，先查看所选工具的 `options`、`response` 和执行价格。更多细节参见 [Find Tools](#find-tools)。
  </Step>

  <Step title="获取数据">
    使用 `scrape` 调用该工具，并按其约定传入相应输入参数。在 `alexandria` 下指定 provider 和 capability，无需提供页面 URL。

    <CodeGroup>
      ```javascript JavaScript theme={null}
      const episodes = await firecrawl.scrape({
        alexandria: {
          provider: "particle",
          capability: "podcasts/episodes/search",
          options: {
            semantic_search: "AI agents",
            limit: 2,
          },
        },
      });

      console.log(episodes.alexandria[0].data);
      ```

      ```python Python theme={null}
      episodes = firecrawl.scrape(
          alexandria={
              "provider": "particle",
              "capability": "podcasts/episodes/search",
              "options": {
                  "semantic_search": "AI agents",
                  "limit": 2,
              },
          },
      )

      print(episodes.alexandria[0].data)
      ```

      ```bash cURL theme={null}
      REQUEST_ID="$(uuidgen)"

      curl https://api.firecrawl.dev/v2/scrape \
        -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
        -H "Content-Type: application/json" \
        -H "x-request-id: $REQUEST_ID" \
        -d '{
        "alexandria": {
          "provider": "particle",
          "capability": "podcasts/episodes/search",
          "options": {
            "semantic_search": "AI agents",
            "limit": 2
          }
        }
      }'
      ```
    </CodeGroup>

    从 `episodes.alexandria[0].data` 读取结果。使用数据前，请先检查每个工具结果是否报错。原始 HTTP 响应会将 SDK 结果包装在 `data` 中。
  </Step>
</Steps>

<h2 id="find-tools">
  Find Tools
</h2>

使用 `findTools` / `find_tools` 即可免费浏览提供商并查看其工具。沿着某个条目的 `next` 请求可获取更多详情；顶层的 `next` 用于对目录分页。

<CodeGroup>
  ```javascript JavaScript theme={null}
  const catalogue = await firecrawl.findTools({
    providers: ["particle"],
    limit: 2,
  });

  // 每个 next 请求都会展现目录的另一部分。
  const next = catalogue.items[0]?.next;
  if (next) {
    const details = await firecrawl.scrape({ alexandria: next });
    console.log(details.alexandria[0].data);
  }
  ```

  ```python Python theme={null}
  catalogue = firecrawl.find_tools(providers=["particle"], limit=2)

  if catalogue.items and catalogue.items[0].get("next"):
      details = firecrawl.scrape(alexandria=catalogue.items[0]["next"])
      print(details.alexandria[0].data)
  ```
</CodeGroup>

<h2 id="pricing-and-access">
  价格与访问
</h2>

* **工具发现：** 免费。使用 `sources: ["alexandria"]` 仅获取工具，或使用 `["web", "alexandria"]` 同时包含付费的网页结果。
* **执行：** 按工具标价计费。
* **提供商条款：** `THIRD_PARTY_DATA_TERMS_REQUIRED` 错误中会包含 `requiresAction.url`。组织管理员需在该页面查看并接受条款。代理在接受条款前须获得用户的明确授权。[代理](/zh/features/agent#data-providers-that-need-terms)运行时会跳过你的团队尚未接受条款的提供商，并在 `exchange.skippedProviders` 中列出这些提供商。

<AccordionGroup>
  <Accordion title="为某个网站查找工具">
    在搜索或普通的 URL 抓取中添加 `domainTools: true`，即可包含与该网站匹配的工具。匹配免费；网页搜索或页面抓取照常计费。结果中会包含 `matchedBy` 和 `matchedUrls`。

    当 `sources` 包含 `alexandria` 时，搜索默认启用域名匹配，可设置 `domainTools: false` 将其关闭。对于 URL 抓取，域名匹配默认关闭。
  </Accordion>
</AccordionGroup>

<h2 id="feedback">
  Feedback
</h2>

使用 `firecrawl alexandria feedback` 报告 issue 或请求新功能。运行 `firecrawl alexandria feedback --help` 查看选项。
