Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![npm version](https://img.shields.io/npm/v/@openserp/n8n-nodes-openserp.svg)](https://www.npmjs.com/package/@openserp/n8n-nodes-openserp)
[![license](https://img.shields.io/npm/l/@openserp/n8n-nodes-openserp.svg)](https://github.com/openserpapi/n8n/blob/main/LICENSE.md)

n8n community node for OpenSERP. It supports web search, image search, single and batch URL extraction, OpenSERP Cloud account/pricing calls, and Cloud engine capability/status calls.
n8n community node for OpenSERP. It supports web search, image search, single and batch URL extraction, OpenSERP Cloud account/pricing calls, Cloud engine capability/status calls, and use as a tool by n8n AI Agents.

## Install

Expand Down Expand Up @@ -39,8 +39,44 @@ API Key: leave empty
Base URL: http://localhost:7000
```

For a server running on another machine, set **Base URL** to that server's root URL, for example `http://openserp-host:7000`. Do not append `/v1` to a self-hosted URL.

The credential test calls `/v1/me` when an API key is present and `/health` when no API key is present.

## Use with n8n AI Agents

OpenSERP uses n8n's native app-node tool wrapper. The normal OpenSERP node and the generated **OpenSERP Tool** are shipped in this same package; a second repository or npm package is not required.

1. Install or update to `@openserp/n8n-nodes-openserp@0.2.0` or later, then restart n8n.
2. Add an **AI Agent** and connect a chat model.
3. From the AI Agent's **Tool** connector, add **OpenSERP Tool**.
4. Select the OpenSERP credential, resource, operation, and any limits you want to keep under workflow-owner control.
5. For fields the model should choose, select n8n's **Let the model define this parameter** button.

Recommended AI-controlled fields:

- **Query** for web or image search.
- **Region**, **Language**, **Date Range**, **File Extension**, and **Site** when the user's request should determine filters.
- **URL** for single-page extraction.

Recommended workflow-controlled fields:

- **Resource** and **Operation**, which define the tool's purpose.
- **Limit**, **Engines**, **Mode**, extraction depth, and timeout, which affect cost, latency, and result size.
- Credentials and base URL.

For example, configure one OpenSERP Tool as `Search / Mega`, keep `Limit: 10`, `Mode: Balanced`, and `Extract Top Results: false`, then let the model fill **Query**, **Region**, and **Language**. A second tool can be configured as `Extract / Get Content` and let the model fill only **URL**.

n8n adds a generated tool description based on the selected resource and operation. You can switch it to a manual description when the agent needs stricter routing instructions, for example: `Search the public web for current factual information. Return source URLs with the result.`

On older self-hosted n8n releases that block community packages from being used as tools, set the following environment variable and restart n8n:

```text
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
```

The `$fromAI()` function and the model-fill button only work while the node is connected to an AI Agent as a tool. Keep fixed limits for untrusted prompts so the model cannot create unexpectedly large searches or extraction requests.

## Operations

- **Search: Single** returns one n8n item per web result from one engine.
Expand Down
5 changes: 3 additions & 2 deletions nodes/OpenSerp/OpenSerp.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import type {
SearchParams,
} from '@openserp/sdk';
import {
NodeConnectionTypes,
NodeOperationError,
type ICredentialDataDecryptedObject,
type IExecuteFunctions,
Expand Down Expand Up @@ -102,7 +101,8 @@ const commonQueryProperties: INodeProperties[] = [
default: '',
required: true,
placeholder: 'openserp',
description: 'Search query text',
description:
'Search query text. When used as an AI Agent tool, this is the main parameter to let the model fill.',
},
{
displayName: 'Limit',
Expand Down Expand Up @@ -202,6 +202,7 @@ export class OpenSerp implements INodeType {
defaults: {
name: "OpenSERP",
},
usableAsTool: true,
inputs: ["main"],
outputs: ["main"],
credentials: [
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openserp/n8n-nodes-openserp",
"version": "0.1.5",
"description": "n8n community node for OpenSERP search, image search, extraction, account, and engine status operations.",
"version": "0.2.0",
"description": "n8n community node and AI Agent tool for OpenSERP search, image search, extraction, account, and engine status operations.",
"license": "MIT",
"author": {
"name": "OpenSERP"
Expand All @@ -23,6 +23,8 @@
"search",
"search-api",
"image-search",
"ai-agent",
"ai-tool",
"seo",
"automation"
],
Expand Down