@olane/o-tool-registry 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +253 -0
- package/dist/apple/apple.tool.d.ts +70 -0
- package/dist/apple/apple.tool.d.ts.map +1 -0
- package/dist/apple/apple.tool.js +12 -0
- package/dist/apple/apple.tool.js.map +1 -0
- package/dist/apple/index.d.ts +1 -0
- package/dist/apple/index.d.ts.map +1 -0
- package/dist/apple/index.js +1 -0
- package/dist/apple/index.js.map +1 -0
- package/dist/apple/notes.tool.d.ts +78 -0
- package/dist/apple/notes.tool.d.ts.map +1 -0
- package/dist/apple/notes.tool.js +216 -0
- package/dist/apple/notes.tool.js.map +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/interfaces/index.d.ts +4 -0
- package/dist/auth/interfaces/index.d.ts.map +1 -0
- package/dist/auth/interfaces/index.js +4 -0
- package/dist/auth/interfaces/index.js.map +1 -0
- package/dist/auth/interfaces/oAuth-tokens.interface.d.ts +9 -0
- package/dist/auth/interfaces/oAuth-tokens.interface.d.ts.map +1 -0
- package/dist/auth/interfaces/oAuth-tokens.interface.js +2 -0
- package/dist/auth/interfaces/oAuth-tokens.interface.js.map +1 -0
- package/dist/auth/interfaces/oAuth-user-info.interface.d.ts +8 -0
- package/dist/auth/interfaces/oAuth-user-info.interface.d.ts.map +1 -0
- package/dist/auth/interfaces/oAuth-user-info.interface.js +2 -0
- package/dist/auth/interfaces/oAuth-user-info.interface.js.map +1 -0
- package/dist/auth/interfaces/oAuth.config.d.ts +14 -0
- package/dist/auth/interfaces/oAuth.config.d.ts.map +1 -0
- package/dist/auth/interfaces/oAuth.config.js +2 -0
- package/dist/auth/interfaces/oAuth.config.js.map +1 -0
- package/dist/auth/methods/auth.methods.d.ts +5 -0
- package/dist/auth/methods/auth.methods.d.ts.map +1 -0
- package/dist/auth/methods/auth.methods.js +303 -0
- package/dist/auth/methods/auth.methods.js.map +1 -0
- package/dist/auth/oAuth.tool.d.ts +20 -0
- package/dist/auth/oAuth.tool.d.ts.map +1 -0
- package/dist/auth/oAuth.tool.js +410 -0
- package/dist/auth/oAuth.tool.js.map +1 -0
- package/dist/embeddings/embeddings.tool.d.ts +70 -0
- package/dist/embeddings/embeddings.tool.d.ts.map +1 -0
- package/dist/embeddings/embeddings.tool.js +12 -0
- package/dist/embeddings/embeddings.tool.js.map +1 -0
- package/dist/embeddings/huggingface-text-embeddings.tool.d.ts +9 -0
- package/dist/embeddings/huggingface-text-embeddings.tool.d.ts.map +1 -0
- package/dist/embeddings/huggingface-text-embeddings.tool.js +23 -0
- package/dist/embeddings/huggingface-text-embeddings.tool.js.map +1 -0
- package/dist/embeddings/index.d.ts +4 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +4 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/methods/text-embeddings.method.d.ts +5 -0
- package/dist/embeddings/methods/text-embeddings.method.d.ts.map +1 -0
- package/dist/embeddings/methods/text-embeddings.method.js +30 -0
- package/dist/embeddings/methods/text-embeddings.method.js.map +1 -0
- package/dist/embeddings/text-embeddings.tool.d.ts +72 -0
- package/dist/embeddings/text-embeddings.tool.d.ts.map +1 -0
- package/dist/embeddings/text-embeddings.tool.js +14 -0
- package/dist/embeddings/text-embeddings.tool.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +3 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +37 -0
- package/dist/init.js.map +1 -0
- package/dist/intelligence/anthropic-intelligence.tool.d.ts +258 -0
- package/dist/intelligence/anthropic-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/anthropic-intelligence.tool.js +447 -0
- package/dist/intelligence/anthropic-intelligence.tool.js.map +1 -0
- package/dist/intelligence/gemini-intelligence.tool.d.ts +78 -0
- package/dist/intelligence/gemini-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/gemini-intelligence.tool.js +254 -0
- package/dist/intelligence/gemini-intelligence.tool.js.map +1 -0
- package/dist/intelligence/index.d.ts +6 -0
- package/dist/intelligence/index.d.ts.map +1 -0
- package/dist/intelligence/index.js +6 -0
- package/dist/intelligence/index.js.map +1 -0
- package/dist/intelligence/intelligence.tool.d.ts +76 -0
- package/dist/intelligence/intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/intelligence.tool.js +109 -0
- package/dist/intelligence/intelligence.tool.js.map +1 -0
- package/dist/intelligence/methods/intelligence.methods.d.ts +5 -0
- package/dist/intelligence/methods/intelligence.methods.d.ts.map +1 -0
- package/dist/intelligence/methods/intelligence.methods.js +99 -0
- package/dist/intelligence/methods/intelligence.methods.js.map +1 -0
- package/dist/intelligence/ollama-intelligence.tool.d.ts +79 -0
- package/dist/intelligence/ollama-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/ollama-intelligence.tool.js +288 -0
- package/dist/intelligence/ollama-intelligence.tool.js.map +1 -0
- package/dist/intelligence/openai-intelligence.tool.d.ts +79 -0
- package/dist/intelligence/openai-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/openai-intelligence.tool.js +242 -0
- package/dist/intelligence/openai-intelligence.tool.js.map +1 -0
- package/dist/intelligence/perplexity-intelligence.tool.d.ts +76 -0
- package/dist/intelligence/perplexity-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/perplexity-intelligence.tool.js +292 -0
- package/dist/intelligence/perplexity-intelligence.tool.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/mcp-bridge.tool.d.ts +76 -0
- package/dist/mcp/mcp-bridge.tool.d.ts.map +1 -0
- package/dist/mcp/mcp-bridge.tool.js +115 -0
- package/dist/mcp/mcp-bridge.tool.js.map +1 -0
- package/dist/mcp/mcp.tool.d.ts +85 -0
- package/dist/mcp/mcp.tool.d.ts.map +1 -0
- package/dist/mcp/mcp.tool.js +80 -0
- package/dist/mcp/mcp.tool.js.map +1 -0
- package/dist/mcp/methods/mcp-bridge.methods.d.ts +5 -0
- package/dist/mcp/methods/mcp-bridge.methods.d.ts.map +1 -0
- package/dist/mcp/methods/mcp-bridge.methods.js +52 -0
- package/dist/mcp/methods/mcp-bridge.methods.js.map +1 -0
- package/dist/nlp/index.d.ts +2 -0
- package/dist/nlp/index.d.ts.map +1 -0
- package/dist/nlp/index.js +2 -0
- package/dist/nlp/index.js.map +1 -0
- package/dist/nlp/methods/nlp.methods.d.ts +5 -0
- package/dist/nlp/methods/nlp.methods.d.ts.map +1 -0
- package/dist/nlp/methods/nlp.methods.js +16 -0
- package/dist/nlp/methods/nlp.methods.js.map +1 -0
- package/dist/nlp/ner.tool.d.ts +71 -0
- package/dist/nlp/ner.tool.d.ts.map +1 -0
- package/dist/nlp/ner.tool.js +26 -0
- package/dist/nlp/ner.tool.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vector-store/index.d.ts +3 -0
- package/dist/vector-store/index.d.ts.map +1 -0
- package/dist/vector-store/index.js +3 -0
- package/dist/vector-store/index.js.map +1 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.d.ts +14 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.d.ts.map +1 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.js +64 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.js.map +1 -0
- package/dist/vector-store/methods/vector-store.methods.d.ts +5 -0
- package/dist/vector-store/methods/vector-store.methods.d.ts.map +1 -0
- package/dist/vector-store/methods/vector-store.methods.js +61 -0
- package/dist/vector-store/methods/vector-store.methods.js.map +1 -0
- package/dist/vector-store/vector-memory.tool.d.ts +75 -0
- package/dist/vector-store/vector-memory.tool.d.ts.map +1 -0
- package/dist/vector-store/vector-memory.tool.js +14 -0
- package/dist/vector-store/vector-memory.tool.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { oToolConfig, ToolResult } from '@olane/o-tool';
|
|
2
|
+
import { oAddress, oDependency, oRequest, oVirtualNode } from '@olane/o-core';
|
|
3
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
4
|
+
import { McpTool } from './mcp.tool';
|
|
5
|
+
declare const McpBridgeTool_base: (new (...args: any[]) => {
|
|
6
|
+
validateToolCall(oRequest: oRequest): boolean;
|
|
7
|
+
handleProtocol(address: oAddress): Promise<void>;
|
|
8
|
+
initialize(): Promise<void>;
|
|
9
|
+
use(address: oAddress, data: {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}, config?: import("@olane/o-core").UseOptions): Promise<import("@olane/o-core").oResponse>;
|
|
12
|
+
handleStream(streamData: import("@olane/o-config/dist").IncomingStreamData): Promise<void>;
|
|
13
|
+
execute(req: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<import("@olane/o-tool").RunResult>;
|
|
14
|
+
run(request: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<import("@olane/o-tool").RunResult>;
|
|
15
|
+
myTools(): string[];
|
|
16
|
+
myToolParams(tool: string): Record<string, any>;
|
|
17
|
+
callMyTool(request: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<ToolResult>;
|
|
18
|
+
index(): Promise<{
|
|
19
|
+
provider: string;
|
|
20
|
+
summary: string;
|
|
21
|
+
} | {
|
|
22
|
+
summary: string | null;
|
|
23
|
+
provider?: undefined;
|
|
24
|
+
}>;
|
|
25
|
+
_tool_index_network(request: oRequest): Promise<ToolResult>;
|
|
26
|
+
whoami(): Promise<{
|
|
27
|
+
tools: string[];
|
|
28
|
+
description: string;
|
|
29
|
+
}>;
|
|
30
|
+
findMissingParams(methodName: string, params: any): import("@olane/o-protocol/dist").oParameter[];
|
|
31
|
+
readonly config: import("@olane/o-core").CoreConfig;
|
|
32
|
+
p2pNode: import("@olane/o-config/dist").Libp2p;
|
|
33
|
+
logger: import("@olane/o-core").Logger;
|
|
34
|
+
networkConfig: import("@olane/o-config/dist").Libp2pConfig;
|
|
35
|
+
address: oAddress;
|
|
36
|
+
readonly staticAddress: oAddress;
|
|
37
|
+
peerId: import("@olane/o-config/dist").PeerId;
|
|
38
|
+
state: import("@olane/o-core").NodeState;
|
|
39
|
+
errors: Error[];
|
|
40
|
+
connectionManager: import("@olane/o-core").oConnectionManager;
|
|
41
|
+
leaders: import("@olane/o-config/dist").Multiaddr[];
|
|
42
|
+
addressResolution: import("@olane/o-core").oAddressResolution;
|
|
43
|
+
readonly description: string;
|
|
44
|
+
dependencies: oDependency[];
|
|
45
|
+
methods: {
|
|
46
|
+
[key: string]: import("@olane/o-protocol/dist").oMethod;
|
|
47
|
+
};
|
|
48
|
+
successCount: number;
|
|
49
|
+
errorCount: number;
|
|
50
|
+
get type(): import("@olane/o-core").NodeType;
|
|
51
|
+
get transports(): string[];
|
|
52
|
+
get parent(): oAddress | null;
|
|
53
|
+
get parentTransports(): import("@olane/o-config/dist").Multiaddr[];
|
|
54
|
+
getTransports(address: oAddress): import("@olane/o-config/dist").Multiaddr[];
|
|
55
|
+
handleStaticAddressTranslation(addressInput: oAddress): Promise<oAddress>;
|
|
56
|
+
translateAddress(addressWithLeaderTransports: oAddress): Promise<{
|
|
57
|
+
nextHopAddress: oAddress;
|
|
58
|
+
targetAddress: oAddress;
|
|
59
|
+
}>;
|
|
60
|
+
advertiseToNetwork(): Promise<void>;
|
|
61
|
+
connectToParent(): Promise<void>;
|
|
62
|
+
register(): Promise<void>;
|
|
63
|
+
connect(nextHopAddress: oAddress, targetAddress: oAddress): Promise<import("@olane/o-core").oConnection>;
|
|
64
|
+
teardown(): Promise<void>;
|
|
65
|
+
start(): Promise<void>;
|
|
66
|
+
stop(): Promise<void>;
|
|
67
|
+
}) & typeof oVirtualNode;
|
|
68
|
+
export declare class McpBridgeTool extends McpBridgeTool_base {
|
|
69
|
+
constructor(config: oToolConfig);
|
|
70
|
+
_tool_add_remote_server(request: oRequest): Promise<ToolResult>;
|
|
71
|
+
_tool_add_remote_server_with_api_key(request: oRequest): Promise<ToolResult>;
|
|
72
|
+
_tool_add_local_server(request: oRequest): Promise<ToolResult>;
|
|
73
|
+
createMcpTool(mcpClient: Client, url: string, name?: string): Promise<McpTool>;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=mcp-bridge.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-bridge.tool.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-bridge.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;;;;;;aASK,CAAC;;iCAK2B,CAAC;iCAG1C,CAAC;;;wCAIS,CAAC;;;;;;gBAOlC,CAAJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAxBF,qBAAa,aAAc,SAAQ,kBAAmB;gBACxC,MAAM,EAAE,WAAW;IASzB,uBAAuB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAiC/D,oCAAoC,CACxC,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC,UAAU,CAAC;IAmDhB,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IA+B9D,aAAa,CACjB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC;CA4BpB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { oTool } from '@olane/o-tool';
|
|
2
|
+
import { oAddress, oVirtualNode } from '@olane/o-core';
|
|
3
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
4
|
+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
5
|
+
import { McpTool } from './mcp.tool';
|
|
6
|
+
import { MCP_BRIDGE_METHODS } from './methods/mcp-bridge.methods';
|
|
7
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
8
|
+
export class McpBridgeTool extends oTool(oVirtualNode) {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super({
|
|
11
|
+
...config,
|
|
12
|
+
address: new oAddress('o://mcp'),
|
|
13
|
+
description: 'Tool to help add MCP servers to the network',
|
|
14
|
+
methods: MCP_BRIDGE_METHODS,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async _tool_add_remote_server(request) {
|
|
18
|
+
const params = request.params;
|
|
19
|
+
const { mcpServerUrl } = params;
|
|
20
|
+
try {
|
|
21
|
+
this.logger.debug('Adding MCP server: ' + mcpServerUrl);
|
|
22
|
+
const transport = new StreamableHTTPClientTransport(new URL(mcpServerUrl));
|
|
23
|
+
const mcpClient = new Client({
|
|
24
|
+
name: 'o-node:mcp:' + this.peerId.toString(),
|
|
25
|
+
version: '1.0.0',
|
|
26
|
+
});
|
|
27
|
+
await mcpClient.connect(transport);
|
|
28
|
+
await this.createMcpTool(mcpClient, mcpServerUrl);
|
|
29
|
+
return {
|
|
30
|
+
message: 'Successfully added MCP server with ' +
|
|
31
|
+
this.childNodes.length +
|
|
32
|
+
' tools',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
throw new Error('Error when trying to add MCP server (' +
|
|
37
|
+
mcpServerUrl +
|
|
38
|
+
') to the network: ' +
|
|
39
|
+
e?.message);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async _tool_add_remote_server_with_api_key(request) {
|
|
43
|
+
const params = request.params;
|
|
44
|
+
const { mcpServerUrl, apiKey } = params;
|
|
45
|
+
try {
|
|
46
|
+
this.logger.debug('Adding API keyed MCP server: ' + mcpServerUrl, apiKey);
|
|
47
|
+
const transport = new StreamableHTTPClientTransport(new URL(mcpServerUrl), {
|
|
48
|
+
requestInit: {
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: `Bearer ${apiKey}`,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const mcpClient = new Client({
|
|
55
|
+
name: 'o-node:mcp:' + this.peerId.toString(),
|
|
56
|
+
version: '1.0.0',
|
|
57
|
+
});
|
|
58
|
+
await mcpClient.connect(transport);
|
|
59
|
+
await this.createMcpTool(mcpClient, mcpServerUrl);
|
|
60
|
+
return {
|
|
61
|
+
_save: true,
|
|
62
|
+
message: 'Successfully added MCP server with ' +
|
|
63
|
+
this.childNodes.length +
|
|
64
|
+
' tools',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
throw new Error('Error when trying to add MCP server (' +
|
|
69
|
+
mcpServerUrl +
|
|
70
|
+
') to the network: ' +
|
|
71
|
+
e?.message);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async _tool_add_local_server(request) {
|
|
75
|
+
const params = request.params;
|
|
76
|
+
this.logger.debug('Adding local MCP server: ', params);
|
|
77
|
+
const { command, args, name } = params;
|
|
78
|
+
const transport = new StdioClientTransport({
|
|
79
|
+
command: command,
|
|
80
|
+
args: args,
|
|
81
|
+
});
|
|
82
|
+
const mcpClient = new Client({
|
|
83
|
+
name: 'o-node:mcp:' + this.peerId.toString(),
|
|
84
|
+
version: '1.0.0',
|
|
85
|
+
});
|
|
86
|
+
await mcpClient.connect(transport);
|
|
87
|
+
await this.createMcpTool(mcpClient, args.join(' '), name);
|
|
88
|
+
return {
|
|
89
|
+
_save: true,
|
|
90
|
+
message: 'Successfully added local MCP server',
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async createMcpTool(mcpClient, url, name) {
|
|
94
|
+
this.logger.debug('Creating MCP tool: ', name, url);
|
|
95
|
+
const mcpTool = new McpTool({
|
|
96
|
+
name: name || 'mcp-' + Date.now(),
|
|
97
|
+
description: 'MCP server for ' + url,
|
|
98
|
+
address: new oAddress(`o://${name || `mcp-${Date.now()}`}`),
|
|
99
|
+
mcpClient: mcpClient,
|
|
100
|
+
dependencies: [],
|
|
101
|
+
leader: this.config.leader,
|
|
102
|
+
parent: this.address,
|
|
103
|
+
});
|
|
104
|
+
this.addChildNode(mcpTool);
|
|
105
|
+
await this.startChildren();
|
|
106
|
+
await this.use(mcpTool.address, {
|
|
107
|
+
method: 'index_network',
|
|
108
|
+
params: {},
|
|
109
|
+
}, {
|
|
110
|
+
noIndex: true,
|
|
111
|
+
});
|
|
112
|
+
return mcpTool;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=mcp-bridge.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-bridge.tool.js","sourceRoot":"","sources":["../../src/mcp/mcp-bridge.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA2B,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAyB,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,Y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+
import { oToolConfig } from '@olane/o-tool';
|
|
2
|
+
import { oAddress, oDependency, oRequest, oVirtualNode } from '@olane/o-core';
|
|
3
|
+
import { oParameter } from '@olane/o-protocol';
|
|
4
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
|
+
declare const McpTool_base: (new (...args: any[]) => {
|
|
6
|
+
validateToolCall(oRequest: oRequest): boolean;
|
|
7
|
+
handleProtocol(address: oAddress): Promise<void>;
|
|
8
|
+
initialize(): Promise<void>;
|
|
9
|
+
use(address: oAddress, data: {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}, config?: import("@olane/o-core").UseOptions): Promise<import("@olane/o-core").oResponse>;
|
|
12
|
+
handleStream(streamData: import("@olane/o-config/dist").IncomingStreamData): Promise<void>;
|
|
13
|
+
execute(req: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<import("@olane/o-tool").RunResult>;
|
|
14
|
+
run(request: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<import("@olane/o-tool").RunResult>;
|
|
15
|
+
myTools(): string[];
|
|
16
|
+
myToolParams(tool: string): Record<string, any>;
|
|
17
|
+
callMyTool(request: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<import("@olane/o-tool").ToolResult>;
|
|
18
|
+
index(): Promise<{
|
|
19
|
+
provider: string;
|
|
20
|
+
summary: string;
|
|
21
|
+
} | {
|
|
22
|
+
summary: string | null;
|
|
23
|
+
provider?: undefined;
|
|
24
|
+
}>;
|
|
25
|
+
_tool_index_network(request: oRequest): Promise<import("@olane/o-tool").ToolResult>;
|
|
26
|
+
whoami(): Promise<{
|
|
27
|
+
tools: string[];
|
|
28
|
+
description: string;
|
|
29
|
+
}>;
|
|
30
|
+
findMissingParams(methodName: string, params: any): oParameter[];
|
|
31
|
+
readonly config: import("@olane/o-core").CoreConfig;
|
|
32
|
+
p2pNode: import("@olane/o-config/dist").Libp2p;
|
|
33
|
+
logger: import("@olane/o-core").Logger;
|
|
34
|
+
networkConfig: import("@olane/o-config/dist").Libp2pConfig;
|
|
35
|
+
address: oAddress;
|
|
36
|
+
readonly staticAddress: oAddress;
|
|
37
|
+
peerId: import("@olane/o-config/dist").PeerId;
|
|
38
|
+
state: import("@olane/o-core").NodeState;
|
|
39
|
+
errors: Error[];
|
|
40
|
+
connectionManager: import("@olane/o-core").oConnectionManager;
|
|
41
|
+
leaders: import("@olane/o-config/dist").Multiaddr[];
|
|
42
|
+
addressResolution: import("@olane/o-core").oAddressResolution;
|
|
43
|
+
readonly description: string;
|
|
44
|
+
dependencies: oDependency[];
|
|
45
|
+
methods: {
|
|
46
|
+
[key: string]: import("@olane/o-protocol").oMethod;
|
|
47
|
+
};
|
|
48
|
+
successCount: number;
|
|
49
|
+
errorCount: number;
|
|
50
|
+
get type(): import("@olane/o-core").NodeType;
|
|
51
|
+
get transports(): string[];
|
|
52
|
+
get parent(): oAddress | null;
|
|
53
|
+
get parentTransports(): import("@olane/o-config/dist").Multiaddr[];
|
|
54
|
+
getTransports(address: oAddress): import("@olane/o-config/dist").Multiaddr[];
|
|
55
|
+
handleStaticAddressTranslation(addressInput: oAddress): Promise<oAddress>;
|
|
56
|
+
translateAddress(addressWithLeaderTransports: oAddress): Promise<{
|
|
57
|
+
nextHopAddress: oAddress;
|
|
58
|
+
targetAddress: oAddress;
|
|
59
|
+
}>;
|
|
60
|
+
advertiseToNetwork(): Promise<void>;
|
|
61
|
+
connectToParent(): Promise<void>;
|
|
62
|
+
register(): Promise<void>;
|
|
63
|
+
connect(nextHopAddress: oAddress, targetAddress: oAddress): Promise<import("@olane/o-core").oConnection>;
|
|
64
|
+
teardown(): Promise<void>;
|
|
65
|
+
start(): Promise<void>;
|
|
66
|
+
stop(): Promise<void>;
|
|
67
|
+
}) & typeof oVirtualNode;
|
|
68
|
+
export declare class McpTool extends McpTool_base {
|
|
69
|
+
private mcpClient;
|
|
70
|
+
constructor(config: oToolConfig & {
|
|
71
|
+
address: oAddress;
|
|
72
|
+
mcpClient: Client;
|
|
73
|
+
});
|
|
74
|
+
setupTools(mcpClient: Client): Promise<void>;
|
|
75
|
+
index(): Promise<{
|
|
76
|
+
provider: string;
|
|
77
|
+
summary: string;
|
|
78
|
+
} | {
|
|
79
|
+
summary: string | null;
|
|
80
|
+
provider?: undefined;
|
|
81
|
+
}>;
|
|
82
|
+
whoami(): Promise<any>;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=mcp.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.tool.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;;;;;;;aAezC,CAAC;;iCAIc,CAAC;iCAEvB,CAAC;;;wCAGY,CAAC;;;;;;gBAKrB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA1Bb,qBAAa,OAAQ,SAAQ,YAAmB;IAC9C,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,WAAW,GAAG;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAepE,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B5C,KAAK;;;;;;;IA2BL,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC;CAe7B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { oTool } from '@olane/o-tool';
|
|
2
|
+
import { oAddress, oVirtualNode } from '@olane/o-core';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
+
export class McpTool extends oTool(oVirtualNode) {
|
|
5
|
+
mcpClient;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
super({
|
|
8
|
+
...config,
|
|
9
|
+
address: config.address,
|
|
10
|
+
description: config.description ||
|
|
11
|
+
'Tool for wrapping MCP servers to be used as tools in the network',
|
|
12
|
+
});
|
|
13
|
+
this.mcpClient = config.mcpClient;
|
|
14
|
+
this.setupTools(this.mcpClient).catch((err) => {
|
|
15
|
+
this.logger.error('Error setting up MCP tools: ', err);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async setupTools(mcpClient) {
|
|
19
|
+
this.logger.debug('Setting up MCP tools');
|
|
20
|
+
const tools = await mcpClient.listTools();
|
|
21
|
+
this.logger.debug('MCP tools: ', tools);
|
|
22
|
+
tools.tools.forEach((tool) => {
|
|
23
|
+
this.logger.debug('Setting up MCP server tool: ' + tool.name);
|
|
24
|
+
this.methods[tool.name] = {
|
|
25
|
+
name: tool.name,
|
|
26
|
+
description: tool.description || '',
|
|
27
|
+
parameters: tool.inputSchema,
|
|
28
|
+
dependencies: [],
|
|
29
|
+
};
|
|
30
|
+
this[`_tool_${tool.name}`] = async (request) => {
|
|
31
|
+
this.logger.debug('Calling MCP tool: ' + tool.name, request);
|
|
32
|
+
const params = request.params;
|
|
33
|
+
const result = await this.mcpClient.callTool({
|
|
34
|
+
name: tool.name,
|
|
35
|
+
arguments: params,
|
|
36
|
+
});
|
|
37
|
+
return result.content;
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
await this.startChildren();
|
|
41
|
+
}
|
|
42
|
+
async index() {
|
|
43
|
+
const result = await super.index();
|
|
44
|
+
const tools = await this.mcpClient.listTools();
|
|
45
|
+
await Promise.all(tools.tools.map((tool) => {
|
|
46
|
+
return this.use(new oAddress('o://vector-store'), {
|
|
47
|
+
method: 'add_documents',
|
|
48
|
+
params: {
|
|
49
|
+
documents: [
|
|
50
|
+
{
|
|
51
|
+
pageContent: tool.description,
|
|
52
|
+
metadata: {
|
|
53
|
+
address: this.address?.toString() + '/' + tool.name,
|
|
54
|
+
id: uuidv4(),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
})).catch((err) => {
|
|
61
|
+
this.logger.error('Error adding MCP tools to vector store: ', err);
|
|
62
|
+
});
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
async whoami() {
|
|
66
|
+
const tools = await this.mcpClient.listTools();
|
|
67
|
+
console.log('mcp+tools: ', tools);
|
|
68
|
+
return {
|
|
69
|
+
tools: tools.tools.map((tool) => {
|
|
70
|
+
return {
|
|
71
|
+
name: tool.name,
|
|
72
|
+
description: tool.description,
|
|
73
|
+
title: tool.title,
|
|
74
|
+
inputSchema: tool.inputSchema,
|
|
75
|
+
};
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=mcp.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.tool.js","sourceRoot":"","sources":["../../src/mcp/mcp.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAyB,YAAY,EAAE,MAAM,eAAe,CAAC;AAG9E,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,OAAO,OAAQ,SAAQ,KAAK,CAAC,YAAY,CAAC;IACtC,SAAS,CAAS;IAE1B,YAAY,MAA8D;QACxE,KAAK,CAAC;YACJ,GAAG,MAAM;YACT,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,WAAW,EACT,MAAM,CAAC,WAAW;gBAClB,kEAAkE;SACrE,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,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AI,CAAC,KAAK;oBACjB,WAAW,EAAE,IAAI,CAAC,WAAW;iBAC9B,CAAC;YACJ,CAAC,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-bridge.methods.d.ts","sourceRoot":"","sources":["../../../src/mcp/methods/mcp-bridge.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,kBAAkB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAoDxD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const MCP_BRIDGE_METHODS = {
|
|
2
|
+
add_remote_server_with_api_key: {
|
|
3
|
+
name: 'add_remote_server_with_api_key',
|
|
4
|
+
description: 'Add a MCP server that requires an API key to the bridge',
|
|
5
|
+
dependencies: [],
|
|
6
|
+
parameters: [
|
|
7
|
+
{
|
|
8
|
+
name: 'mcpServerUrl',
|
|
9
|
+
type: 'string',
|
|
10
|
+
value: 'string',
|
|
11
|
+
description: 'The URL of the MCP server to use',
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'apiKey',
|
|
16
|
+
type: 'string',
|
|
17
|
+
value: 'string',
|
|
18
|
+
description: 'The API key to use for the MCP server',
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
add_remote_server_with_oauth: {
|
|
24
|
+
name: 'add_remote_server_with_oauth',
|
|
25
|
+
description: 'Add a MCP server that requires an OAuth authentication token to the bridge',
|
|
26
|
+
dependencies: [],
|
|
27
|
+
parameters: [
|
|
28
|
+
{
|
|
29
|
+
name: 'mcpServerUrl',
|
|
30
|
+
type: 'string',
|
|
31
|
+
value: 'string',
|
|
32
|
+
description: 'The URL of the MCP server to use',
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
add_remote_server: {
|
|
38
|
+
name: 'add_remoteserver',
|
|
39
|
+
description: 'Add a MCP server that does not require authentication to the bridge',
|
|
40
|
+
dependencies: [],
|
|
41
|
+
parameters: [
|
|
42
|
+
{
|
|
43
|
+
name: 'mcpServerUrl',
|
|
44
|
+
type: 'string',
|
|
45
|
+
value: 'string',
|
|
46
|
+
description: 'The URL of the MCP server to use',
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=mcp-bridge.methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-bridge.methods.js","sourceRoot":"","sources":["../../../src/mcp/methods/mcp-bridge.methods.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC5D,8BAA8B,EAAE;QAC9B,IAAI,EAAE,gCAAgC;QACtC,WAAW,EAAE,yDAAyD;QACtE,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kCAAkC;gBAC/C,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,uCAAuC;gBACpD,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,4BAA4B,EAAE;QAC5B,IAAI,EAAE,8BAA8B;QACpC,WAAW,EACT,4EAA4E;QAC9E,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kCAAkC;gBAC/C,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,qEAAqE;QACvE,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kCAAkC;gBAC/C,QAAQ,EAAE,IAAI;aACf;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nlp/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nlp/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nlp.methods.d.ts","sourceRoot":"","sources":["../../../src/nlp/methods/nlp.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAchD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const NLP_PARAMS = {
|
|
2
|
+
extract: {
|
|
3
|
+
name: 'extract',
|
|
4
|
+
description: 'Extract',
|
|
5
|
+
dependencies: [],
|
|
6
|
+
parameters: [
|
|
7
|
+
{
|
|
8
|
+
name: 'text',
|
|
9
|
+
type: 'string',
|
|
10
|
+
value: 'string',
|
|
11
|
+
description: 'The text to extract from',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=nlp.methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nlp.methods.js","sourceRoot":"","sources":["../../../src/nlp/methods/nlp.methods.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAA+B;IACpD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,SAAS;QACtB,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,0BAA0B;aACxC;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { oToolConfig, ToolResult } from '@olane/o-tool';
|
|
2
|
+
import { oAddress, oRequest, oVirtualNode } from '@olane/o-core';
|
|
3
|
+
declare const NERTool_base: (new (...args: any[]) => {
|
|
4
|
+
validateToolCall(oRequest: oRequest): boolean;
|
|
5
|
+
handleProtocol(address: oAddress): Promise<void>;
|
|
6
|
+
initialize(): Promise<void>;
|
|
7
|
+
use(address: oAddress, data: {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}, config?: import("@olane/o-core").UseOptions): Promise<import("@olane/o-core").oResponse>;
|
|
10
|
+
handleStream(streamData: import("@olane/o-config/dist").IncomingStreamData): Promise<void>;
|
|
11
|
+
execute(req: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<import("@olane/o-tool").RunResult>;
|
|
12
|
+
run(request: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<import("@olane/o-tool").RunResult>;
|
|
13
|
+
myTools(): string[];
|
|
14
|
+
myToolParams(tool: string): Record<string, any>;
|
|
15
|
+
callMyTool(request: oRequest, stream?: import("@olane/o-config/dist").Stream): Promise<ToolResult>;
|
|
16
|
+
index(): Promise<{
|
|
17
|
+
provider: string;
|
|
18
|
+
summary: string;
|
|
19
|
+
} | {
|
|
20
|
+
summary: string | null;
|
|
21
|
+
provider?: undefined;
|
|
22
|
+
}>;
|
|
23
|
+
_tool_index_network(request: oRequest): Promise<ToolResult>;
|
|
24
|
+
whoami(): Promise<{
|
|
25
|
+
tools: string[];
|
|
26
|
+
description: string;
|
|
27
|
+
}>;
|
|
28
|
+
findMissingParams(methodName: string, params: any): import("@olane/o-protocol/dist").oParameter[];
|
|
29
|
+
readonly config: import("@olane/o-core").CoreConfig;
|
|
30
|
+
p2pNode: import("@olane/o-config/dist").Libp2p;
|
|
31
|
+
logger: import("@olane/o-core").Logger;
|
|
32
|
+
networkConfig: import("@olane/o-config/dist").Libp2pConfig;
|
|
33
|
+
address: oAddress;
|
|
34
|
+
readonly staticAddress: oAddress;
|
|
35
|
+
peerId: import("@olane/o-config/dist").PeerId;
|
|
36
|
+
state: import("@olane/o-core").NodeState;
|
|
37
|
+
errors: Error[];
|
|
38
|
+
connectionManager: import("@olane/o-core").oConnectionManager;
|
|
39
|
+
leaders: import("@olane/o-config/dist").Multiaddr[];
|
|
40
|
+
addressResolution: import("@olane/o-core").oAddressResolution;
|
|
41
|
+
readonly description: string;
|
|
42
|
+
dependencies: import("@olane/o-core").oDependency[];
|
|
43
|
+
methods: {
|
|
44
|
+
[key: string]: import("@olane/o-protocol/dist").oMethod;
|
|
45
|
+
};
|
|
46
|
+
successCount: number;
|
|
47
|
+
errorCount: number;
|
|
48
|
+
get type(): import("@olane/o-core").NodeType;
|
|
49
|
+
get transports(): string[];
|
|
50
|
+
get parent(): oAddress | null;
|
|
51
|
+
get parentTransports(): import("@olane/o-config/dist").Multiaddr[];
|
|
52
|
+
getTransports(address: oAddress): import("@olane/o-config/dist").Multiaddr[];
|
|
53
|
+
handleStaticAddressTranslation(addressInput: oAddress): Promise<oAddress>;
|
|
54
|
+
translateAddress(addressWithLeaderTransports: oAddress): Promise<{
|
|
55
|
+
nextHopAddress: oAddress;
|
|
56
|
+
targetAddress: oAddress;
|
|
57
|
+
}>;
|
|
58
|
+
advertiseToNetwork(): Promise<void>;
|
|
59
|
+
connectToParent(): Promise<void>;
|
|
60
|
+
register(): Promise<void>;
|
|
61
|
+
connect(nextHopAddress: oAddress, targetAddress: oAddress): Promise<import("@olane/o-core").oConnection>;
|
|
62
|
+
teardown(): Promise<void>;
|
|
63
|
+
start(): Promise<void>;
|
|
64
|
+
stop(): Promise<void>;
|
|
65
|
+
}) & typeof oVirtualNode;
|
|
66
|
+
export declare class NERTool extends NERTool_base {
|
|
67
|
+
constructor(config: oToolConfig);
|
|
68
|
+
_tool_extract(request: oRequest): Promise<ToolResult>;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=ner.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ner.tool.d.ts","sourceRoot":"","sources":["../../src/nlp/ner.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;;;;;;aAkBK,CAAC;;iCAIjE,CAAC;iCAKiB,CAAC;;;wCAAiK,CAAC;;;;;;gBAA4L,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAxBxX,qBAAa,OAAQ,SAAQ,YAAmB;gBAClC,MAAM,EAAE,WAAW;IASzB,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAa5D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { oTool } from '@olane/o-tool';
|
|
2
|
+
import { oAddress, oVirtualNode } from '@olane/o-core';
|
|
3
|
+
import { NLP_PARAMS } from './methods/nlp.methods';
|
|
4
|
+
export class NERTool extends oTool(oVirtualNode) {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({
|
|
7
|
+
...config,
|
|
8
|
+
address: new oAddress('o://ner'),
|
|
9
|
+
methods: NLP_PARAMS,
|
|
10
|
+
description: 'Tool to extract named entities from text',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async _tool_extract(request) {
|
|
14
|
+
const params = request.params;
|
|
15
|
+
const { text } = params;
|
|
16
|
+
this.logger.debug('Extracting entities from text', text);
|
|
17
|
+
const response = await this.use(new oAddress('o://intelligence'), {
|
|
18
|
+
method: 'prompt',
|
|
19
|
+
params: {
|
|
20
|
+
prompt: `Extract named entities and their metadata from the following text: ${text}`,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return response.result;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ner.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ner.tool.js","sourceRoot":"","sources":["../../src/nlp/ner.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA2B,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAY,YAAY,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,OAAO,OAAQ,SAAQ,KAAK,CAAC,YAAY,CAAC;IAC9C,YAAY,MAAmB;QAC7B,KAAK,CAAC;YACJ,GAAG,MAAM;YACT,OAAO,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC;YAChC,OAAO,EAAE,UAAU;YACnB,WAAW,EAAE,0CAA0C;SACxD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAiB;QACnC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,EAAE;YAChE,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,MAAM,EAAE,sEAAsE,IAAI,EAAE;aACrF;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB,CAAC;CACF"}
|