secondbrainos-mcp-server 1.2.5 → 1.2.6
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/build/index.js +15 -7
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -6,6 +6,12 @@ import axios from "axios";
|
|
|
6
6
|
import dotenv from "dotenv";
|
|
7
7
|
import yaml from 'js-yaml';
|
|
8
8
|
dotenv.config();
|
|
9
|
+
function toSnakeCase(str) {
|
|
10
|
+
return str
|
|
11
|
+
.toLowerCase()
|
|
12
|
+
.replace(/[^a-z0-9]+/g, '_')
|
|
13
|
+
.replace(/^_+|_+$/g, '');
|
|
14
|
+
}
|
|
9
15
|
class SecondBrainOSServer {
|
|
10
16
|
constructor(initialSchema) {
|
|
11
17
|
this.originalSpec = initialSchema;
|
|
@@ -197,13 +203,15 @@ class SecondBrainOSServer {
|
|
|
197
203
|
this.workflowNameToId.clear();
|
|
198
204
|
for (const wf of workflows) {
|
|
199
205
|
if (wf.name && wf.workflow_id) {
|
|
200
|
-
|
|
206
|
+
const snakeName = `skill_${toSnakeCase(wf.name)}`;
|
|
207
|
+
this.workflowNameToId.set(snakeName, wf.workflow_id);
|
|
201
208
|
}
|
|
202
209
|
}
|
|
203
210
|
for (const wf of workflows) {
|
|
204
211
|
const skillName = wf.name || wf.workflow_id;
|
|
212
|
+
const snakeName = `skill_${toSnakeCase(skillName)}`;
|
|
205
213
|
prompts.push({
|
|
206
|
-
name:
|
|
214
|
+
name: snakeName,
|
|
207
215
|
title: `[Skill] ${skillName}`,
|
|
208
216
|
description: wf.description || wf.name,
|
|
209
217
|
arguments: [
|
|
@@ -227,10 +235,10 @@ class SecondBrainOSServer {
|
|
|
227
235
|
this.agentNameToId.clear();
|
|
228
236
|
for (const agent of agents) {
|
|
229
237
|
if (agent.name && agent.id) {
|
|
230
|
-
const
|
|
231
|
-
this.agentNameToId.set(
|
|
238
|
+
const snakeName = `agent_${toSnakeCase(agent.name)}`;
|
|
239
|
+
this.agentNameToId.set(snakeName, agent.id);
|
|
232
240
|
prompts.push({
|
|
233
|
-
name:
|
|
241
|
+
name: snakeName,
|
|
234
242
|
title: `[Agent] ${agent.name}`,
|
|
235
243
|
description: agent.description || agent.name,
|
|
236
244
|
arguments: [
|
|
@@ -257,7 +265,7 @@ class SecondBrainOSServer {
|
|
|
257
265
|
.filter((id) => id && id.length > 0);
|
|
258
266
|
if (collectionIds.length > 0) {
|
|
259
267
|
prompts.push({
|
|
260
|
-
name: "
|
|
268
|
+
name: "knowledge_bases",
|
|
261
269
|
title: "[Knowledge Bases]",
|
|
262
270
|
description: "Knowledge base collection IDs available to agents",
|
|
263
271
|
arguments: [
|
|
@@ -281,7 +289,7 @@ class SecondBrainOSServer {
|
|
|
281
289
|
const promptName = request.params.name;
|
|
282
290
|
const userInput = request.params.arguments?.user_input;
|
|
283
291
|
// Check if this is the Knowledge Bases prompt
|
|
284
|
-
if (promptName === "
|
|
292
|
+
if (promptName === "knowledge_bases") {
|
|
285
293
|
const agents = await this.fetchAndEnrichAgents();
|
|
286
294
|
const collectionIds = agents
|
|
287
295
|
.map((a) => a.searchMyKnowledge_collection_id)
|