@pipeshub-ai/mcp 2.0.0 → 2.1.0
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/bin/mcp-server.js +719 -100
- package/bin/mcp-server.js.map +20 -13
- package/esm/funcs/agentsListAgents.d.ts +10 -0
- package/esm/funcs/agentsListAgents.d.ts.map +1 -0
- package/esm/funcs/agentsListAgents.js +83 -0
- package/esm/funcs/agentsListAgents.js.map +1 -0
- package/esm/funcs/agentsStreamConversation.d.ts +10 -0
- package/esm/funcs/agentsStreamConversation.d.ts.map +1 -0
- package/esm/funcs/agentsStreamConversation.js +83 -0
- package/esm/funcs/agentsStreamConversation.js.map +1 -0
- package/esm/funcs/agentsStreamMessage.d.ts +10 -0
- package/esm/funcs/agentsStreamMessage.d.ts.map +1 -0
- package/esm/funcs/agentsStreamMessage.js +86 -0
- package/esm/funcs/agentsStreamMessage.js.map +1 -0
- package/esm/funcs/conversationsStreamConversation.d.ts.map +1 -1
- package/esm/funcs/conversationsStreamConversation.js +1 -3
- package/esm/funcs/conversationsStreamConversation.js.map +1 -1
- package/esm/funcs/conversationsStreamMessage.d.ts.map +1 -1
- package/esm/funcs/conversationsStreamMessage.js +0 -7
- package/esm/funcs/conversationsStreamMessage.js.map +1 -1
- package/esm/mcp-server/instructions.d.ts +2 -0
- package/esm/mcp-server/instructions.d.ts.map +1 -0
- package/esm/mcp-server/instructions.js +83 -0
- package/esm/mcp-server/instructions.js.map +1 -0
- package/esm/mcp-server/prompts/pipeshubAssistant.d.ts +8 -0
- package/esm/mcp-server/prompts/pipeshubAssistant.d.ts.map +1 -0
- package/esm/mcp-server/prompts/pipeshubAssistant.js +31 -0
- package/esm/mcp-server/prompts/pipeshubAssistant.js.map +1 -0
- package/esm/mcp-server/server.d.ts.map +1 -1
- package/esm/mcp-server/server.js +7 -60
- package/esm/mcp-server/server.js.map +1 -1
- package/esm/mcp-server/tools/_helpers.d.ts +78 -0
- package/esm/mcp-server/tools/_helpers.d.ts.map +1 -1
- package/esm/mcp-server/tools/_helpers.js +155 -1
- package/esm/mcp-server/tools/_helpers.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubAgents.d.ts +8 -0
- package/esm/mcp-server/tools/pipeshubAgents.d.ts.map +1 -0
- package/esm/mcp-server/tools/pipeshubAgents.js +62 -0
- package/esm/mcp-server/tools/pipeshubAgents.js.map +1 -0
- package/esm/mcp-server/tools/pipeshubChat.d.ts +6 -1
- package/esm/mcp-server/tools/pipeshubChat.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubChat.js +88 -26
- package/esm/mcp-server/tools/pipeshubChat.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubDirectory.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubDirectory.js +0 -1
- package/esm/mcp-server/tools/pipeshubDirectory.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubDownloadRecord.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubDownloadRecord.js +0 -3
- package/esm/mcp-server/tools/pipeshubDownloadRecord.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubSearch.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubSearch.js +0 -3
- package/esm/mcp-server/tools/pipeshubSearch.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubSources.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubSources.js +0 -4
- package/esm/mcp-server/tools/pipeshubSources.js.map +1 -1
- package/esm/models/agentops.d.ts +119 -0
- package/esm/models/agentops.d.ts.map +1 -0
- package/esm/models/agentops.js +97 -0
- package/esm/models/agentops.js.map +1 -0
- package/esm/tool-names.d.ts.map +1 -1
- package/esm/tool-names.js +5 -1
- package/esm/tool-names.js.map +1 -1
- package/package.json +2 -2
- package/src/funcs/agentsListAgents.ts +141 -0
- package/src/funcs/agentsStreamConversation.ts +144 -0
- package/src/funcs/agentsStreamMessage.ts +147 -0
- package/src/funcs/conversationsStreamConversation.ts +1 -3
- package/src/funcs/conversationsStreamMessage.ts +0 -8
- package/src/mcp-server/instructions.ts +83 -0
- package/src/mcp-server/prompts/pipeshubAssistant.ts +37 -0
- package/src/mcp-server/server.ts +8 -62
- package/src/mcp-server/tools/_helpers.ts +216 -1
- package/src/mcp-server/tools/pipeshubAgents.ts +68 -0
- package/src/mcp-server/tools/pipeshubChat.ts +87 -26
- package/src/mcp-server/tools/pipeshubDirectory.ts +0 -1
- package/src/mcp-server/tools/pipeshubDownloadRecord.ts +0 -4
- package/src/mcp-server/tools/pipeshubSearch.ts +0 -3
- package/src/mcp-server/tools/pipeshubSources.ts +0 -5
- package/src/models/agentops.ts +160 -0
- package/src/tool-names.ts +5 -1
package/bin/mcp-server.js
CHANGED
|
@@ -50387,6 +50387,86 @@ var init_mcp = __esm(() => {
|
|
|
50387
50387
|
};
|
|
50388
50388
|
});
|
|
50389
50389
|
|
|
50390
|
+
// src/mcp-server/instructions.ts
|
|
50391
|
+
var PIPESHUB_INSTRUCTIONS = `# PipesHub MCP — instructions for the LLM
|
|
50392
|
+
|
|
50393
|
+
PipesHub is the user's workplace AI platform. It indexes their documents,
|
|
50394
|
+
knowledge base content, and connector sources (Drive, Box, Confluence,
|
|
50395
|
+
Slack, Jira, Gmail, ...). When in doubt, the answer is in PipesHub.
|
|
50396
|
+
|
|
50397
|
+
## Default tool: \`pipeshub_chat\`
|
|
50398
|
+
|
|
50399
|
+
**Use \`pipeshub_chat\` for any question that could plausibly be answered
|
|
50400
|
+
by the user's PipesHub-indexed data.** That includes:
|
|
50401
|
+
|
|
50402
|
+
- Anything about a specific document, file, report, ticket, message, or
|
|
50403
|
+
page (e.g. "what's in the Q4 sales report?", "summarize the langchain
|
|
50404
|
+
doc", "what did Aashil say about onboarding?").
|
|
50405
|
+
- Anything about company / org policies, processes, decisions, or
|
|
50406
|
+
history (e.g. "what's our vacation policy?", "who owns the auth
|
|
50407
|
+
service?").
|
|
50408
|
+
- Anything explicitly mentioning PipesHub itself, or its sources
|
|
50409
|
+
(Drive / Box / Confluence / Slack / Gmail / Jira / etc.) when the
|
|
50410
|
+
user has those connected.
|
|
50411
|
+
- Open-ended "what do we know about X" questions where the answer
|
|
50412
|
+
likely lives in the org's documents.
|
|
50413
|
+
|
|
50414
|
+
Do NOT answer those from your own knowledge — \`pipeshub_chat\` grounds
|
|
50415
|
+
the answer in the user's actual indexed content and returns citations
|
|
50416
|
+
the user can verify.
|
|
50417
|
+
|
|
50418
|
+
## When to use the other tools
|
|
50419
|
+
|
|
50420
|
+
- \`pipeshub_search\` — only when the user asks specifically to **find /
|
|
50421
|
+
locate** a document by name or topic (so you can hand them a list, or
|
|
50422
|
+
resolve a filename to a \`recordId\` for download). For "what does
|
|
50423
|
+
the doc say?" use \`pipeshub_chat\` instead — it does the retrieval
|
|
50424
|
+
internally.
|
|
50425
|
+
- \`pipeshub_download_record\` — when the user wants the actual file
|
|
50426
|
+
bytes (download, attach, open). Get the \`recordId\` either from
|
|
50427
|
+
citations on a prior \`pipeshub_chat\` response or from
|
|
50428
|
+
\`pipeshub_search\`.
|
|
50429
|
+
- \`pipeshub_directory\` — people, groups, teams, and \`whoami\` lookups.
|
|
50430
|
+
Not for documents.
|
|
50431
|
+
- \`pipeshub_sources\` — call once at the start of a session to discover
|
|
50432
|
+
which connectors / KB / models are available, then cache the result.
|
|
50433
|
+
- \`pipeshub_agents\` — list the org's configured **agents** (specialized
|
|
50434
|
+
assistants with their own prompt, tools, and knowledge scope).
|
|
50435
|
+
|
|
50436
|
+
## Agents
|
|
50437
|
+
|
|
50438
|
+
Some orgs configure **agents** for specific jobs (e.g. a Slack messenger, a
|
|
50439
|
+
Jira ticket creator, a Salesforce CRM updater). To run a turn against an
|
|
50440
|
+
agent, call \`pipeshub_chat\` with its \`agentId\` (from \`pipeshub_agents\`)
|
|
50441
|
+
— optionally with an agent \`chatMode\` (\`auto\` by default, or \`quick\` /
|
|
50442
|
+
\`verification\` / \`deep\`). Keep passing the same \`agentId\` plus the
|
|
50443
|
+
returned \`conversationId\` on follow-up turns.
|
|
50444
|
+
|
|
50445
|
+
**When to route to an agent vs plain chat:**
|
|
50446
|
+
- The user names a system/action that maps to an agent (e.g. "post to
|
|
50447
|
+
Slack", "create a Jira ticket", "update the Salesforce deal") → call
|
|
50448
|
+
\`pipeshub_agents\`, pick the matching agent, and use it.
|
|
50449
|
+
- Plain question about the org's knowledge or the public web → just use
|
|
50450
|
+
\`pipeshub_chat\` (no \`agentId\`) with \`internal_search\` or \`web_search\`.
|
|
50451
|
+
|
|
50452
|
+
**If you are unsure which agent or route fits the request**, call
|
|
50453
|
+
\`pipeshub_agents\` FIRST and read the returned names/descriptions, then
|
|
50454
|
+
either pick the best match or present the list to the user and let them
|
|
50455
|
+
choose. Do NOT guess an agent blindly, and do NOT refuse — list the agents
|
|
50456
|
+
and decide from real data. The list may be empty (no agents configured),
|
|
50457
|
+
in which case fall back to plain \`pipeshub_chat\`.
|
|
50458
|
+
|
|
50459
|
+
## Conversation lifecycle
|
|
50460
|
+
|
|
50461
|
+
\`pipeshub_chat\` is a single tool that handles both starting and
|
|
50462
|
+
continuing conversations (plain or with an \`agentId\`). On the first turn
|
|
50463
|
+
omit \`conversationId\`; on every subsequent turn pass back the
|
|
50464
|
+
\`conversationId\` returned by the previous call (along with the same
|
|
50465
|
+
\`agentId\` if you used one). Server-side context is preserved — do NOT
|
|
50466
|
+
replay prior messages. Only start a fresh conversation when the user
|
|
50467
|
+
explicitly asks to clear context.
|
|
50468
|
+
`;
|
|
50469
|
+
|
|
50390
50470
|
// src/hooks/registration.ts
|
|
50391
50471
|
function initHooks(hooks) {}
|
|
50392
50472
|
|
|
@@ -52460,6 +52540,326 @@ var init_conversationsStreamMessage = __esm(() => {
|
|
|
52460
52540
|
init_async();
|
|
52461
52541
|
});
|
|
52462
52542
|
|
|
52543
|
+
// src/models/agentops.ts
|
|
52544
|
+
var ListAgentsRequest$zodSchema, AgentStreamConversationBody$zodSchema, AgentStreamCreateConversationRequest$zodSchema, AgentAddMessageStreamRequest$zodSchema, AgentWebSearch$zodSchema, AgentToolsetTool$zodSchema, AgentToolset$zodSchema, AgentKnowledge$zodSchema, AgentSummary$zodSchema, AgentListPagination$zodSchema, AgentListEnvelope$zodSchema;
|
|
52545
|
+
var init_agentops = __esm(() => {
|
|
52546
|
+
init_zod();
|
|
52547
|
+
init_filters();
|
|
52548
|
+
ListAgentsRequest$zodSchema = object({
|
|
52549
|
+
page: int().optional(),
|
|
52550
|
+
limit: int().optional(),
|
|
52551
|
+
search: string2().optional(),
|
|
52552
|
+
sortBy: string2().optional(),
|
|
52553
|
+
sortOrder: _enum(["asc", "desc"]).optional()
|
|
52554
|
+
});
|
|
52555
|
+
AgentStreamConversationBody$zodSchema = object({
|
|
52556
|
+
query: string2().min(1),
|
|
52557
|
+
recordIds: array(string2()).optional(),
|
|
52558
|
+
filters: Filters$zodSchema.optional(),
|
|
52559
|
+
chatMode: string2().optional(),
|
|
52560
|
+
modelKey: string2().optional(),
|
|
52561
|
+
modelName: string2().optional(),
|
|
52562
|
+
modelFriendlyName: string2().optional(),
|
|
52563
|
+
tools: array(string2()).optional(),
|
|
52564
|
+
timezone: string2().optional(),
|
|
52565
|
+
currentTime: string2().optional()
|
|
52566
|
+
});
|
|
52567
|
+
AgentStreamCreateConversationRequest$zodSchema = object({
|
|
52568
|
+
agentKey: string2().min(1),
|
|
52569
|
+
body: AgentStreamConversationBody$zodSchema
|
|
52570
|
+
});
|
|
52571
|
+
AgentAddMessageStreamRequest$zodSchema = object({
|
|
52572
|
+
agentKey: string2().min(1),
|
|
52573
|
+
conversationId: string2(),
|
|
52574
|
+
body: AgentStreamConversationBody$zodSchema
|
|
52575
|
+
});
|
|
52576
|
+
AgentWebSearch$zodSchema = object({
|
|
52577
|
+
provider: string2().optional(),
|
|
52578
|
+
providerKey: string2().optional(),
|
|
52579
|
+
providerLabel: string2().optional()
|
|
52580
|
+
});
|
|
52581
|
+
AgentToolsetTool$zodSchema = object({
|
|
52582
|
+
name: string2().nullish(),
|
|
52583
|
+
fullName: string2().nullish()
|
|
52584
|
+
});
|
|
52585
|
+
AgentToolset$zodSchema = object({
|
|
52586
|
+
name: string2().nullish(),
|
|
52587
|
+
displayName: string2().nullish(),
|
|
52588
|
+
instanceName: string2().nullish(),
|
|
52589
|
+
tools: array(AgentToolsetTool$zodSchema).default([])
|
|
52590
|
+
});
|
|
52591
|
+
AgentKnowledge$zodSchema = object({
|
|
52592
|
+
name: string2().nullish(),
|
|
52593
|
+
displayName: string2().nullish(),
|
|
52594
|
+
type: string2().nullish()
|
|
52595
|
+
});
|
|
52596
|
+
AgentSummary$zodSchema = object({
|
|
52597
|
+
_key: string2(),
|
|
52598
|
+
name: string2(),
|
|
52599
|
+
description: string2().nullish(),
|
|
52600
|
+
systemPrompt: string2().nullish(),
|
|
52601
|
+
startMessage: string2().nullish(),
|
|
52602
|
+
tags: array(string2()).default([]),
|
|
52603
|
+
webSearch: AgentWebSearch$zodSchema.nullish(),
|
|
52604
|
+
isActive: boolean2().nullish(),
|
|
52605
|
+
toolsets: array(AgentToolset$zodSchema).default([]),
|
|
52606
|
+
knowledge: array(AgentKnowledge$zodSchema).default([])
|
|
52607
|
+
});
|
|
52608
|
+
AgentListPagination$zodSchema = object({
|
|
52609
|
+
totalItems: number2().nullish(),
|
|
52610
|
+
total: number2().nullish(),
|
|
52611
|
+
hasNext: boolean2().nullish(),
|
|
52612
|
+
hasNextPage: boolean2().nullish()
|
|
52613
|
+
});
|
|
52614
|
+
AgentListEnvelope$zodSchema = object({
|
|
52615
|
+
success: boolean2().nullish(),
|
|
52616
|
+
agents: array(AgentSummary$zodSchema).default([]),
|
|
52617
|
+
pagination: AgentListPagination$zodSchema.nullish()
|
|
52618
|
+
});
|
|
52619
|
+
});
|
|
52620
|
+
|
|
52621
|
+
// src/funcs/agentsStreamConversation.ts
|
|
52622
|
+
function agentsStreamConversation(client$, request, options) {
|
|
52623
|
+
return new APIPromise($do3(client$, request, options));
|
|
52624
|
+
}
|
|
52625
|
+
async function $do3(client$, request, options) {
|
|
52626
|
+
const parsed$ = safeParse4(request, (value$) => AgentStreamCreateConversationRequest$zodSchema.parse(value$), "Input validation failed");
|
|
52627
|
+
if (!parsed$.ok) {
|
|
52628
|
+
return [parsed$, { status: "invalid" }];
|
|
52629
|
+
}
|
|
52630
|
+
const payload$ = parsed$.value;
|
|
52631
|
+
const body$ = encodeJSON("body", payload$.body, { explode: true });
|
|
52632
|
+
const pathParams$ = {
|
|
52633
|
+
agentKey: encodeSimple("agentKey", payload$.agentKey, {
|
|
52634
|
+
explode: false,
|
|
52635
|
+
charEncoding: "percent"
|
|
52636
|
+
})
|
|
52637
|
+
};
|
|
52638
|
+
const path$ = pathToFunc("/agents/{agentKey}/conversations/stream")(pathParams$);
|
|
52639
|
+
const headers$ = new Headers(compactMap({
|
|
52640
|
+
"Content-Type": "application/json",
|
|
52641
|
+
Accept: "text/event-stream"
|
|
52642
|
+
}));
|
|
52643
|
+
const securityInput = await extractSecurity(client$._options.security);
|
|
52644
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
52645
|
+
const context = {
|
|
52646
|
+
options: client$._options,
|
|
52647
|
+
baseURL: options?.serverURL ?? client$._baseURL ?? "",
|
|
52648
|
+
operationID: "streamAgentConversation",
|
|
52649
|
+
oAuth2Scopes: ["agent:execute"],
|
|
52650
|
+
resolvedSecurity: requestSecurity,
|
|
52651
|
+
securitySource: client$._options.security,
|
|
52652
|
+
retryConfig: options?.retries || client$._options.retryConfig || { strategy: "none" },
|
|
52653
|
+
retryCodes: options?.retryCodes || [
|
|
52654
|
+
"429",
|
|
52655
|
+
"500",
|
|
52656
|
+
"502",
|
|
52657
|
+
"503",
|
|
52658
|
+
"504"
|
|
52659
|
+
]
|
|
52660
|
+
};
|
|
52661
|
+
const requestRes = client$._createRequest(context, {
|
|
52662
|
+
security: requestSecurity,
|
|
52663
|
+
method: "POST",
|
|
52664
|
+
baseURL: options?.serverURL,
|
|
52665
|
+
path: path$,
|
|
52666
|
+
headers: headers$,
|
|
52667
|
+
body: body$,
|
|
52668
|
+
userAgent: client$._options.userAgent,
|
|
52669
|
+
timeoutMs: options?.timeoutMs || -1
|
|
52670
|
+
}, options);
|
|
52671
|
+
if (!requestRes.ok) {
|
|
52672
|
+
return [requestRes, { status: "invalid" }];
|
|
52673
|
+
}
|
|
52674
|
+
const req$ = requestRes.value;
|
|
52675
|
+
const doResult = await client$._do(req$, {
|
|
52676
|
+
context,
|
|
52677
|
+
errorCodes: [],
|
|
52678
|
+
retryConfig: context.retryConfig,
|
|
52679
|
+
retryCodes: context.retryCodes
|
|
52680
|
+
});
|
|
52681
|
+
if (!doResult.ok) {
|
|
52682
|
+
return [doResult, { status: "request-error", request: req$ }];
|
|
52683
|
+
}
|
|
52684
|
+
return [doResult, {
|
|
52685
|
+
status: "complete",
|
|
52686
|
+
request: req$,
|
|
52687
|
+
response: doResult.value
|
|
52688
|
+
}];
|
|
52689
|
+
}
|
|
52690
|
+
var init_agentsStreamConversation = __esm(() => {
|
|
52691
|
+
init_encodings();
|
|
52692
|
+
init_primitives();
|
|
52693
|
+
init_schemas4();
|
|
52694
|
+
init_security2();
|
|
52695
|
+
init_url();
|
|
52696
|
+
init_agentops();
|
|
52697
|
+
init_async();
|
|
52698
|
+
});
|
|
52699
|
+
|
|
52700
|
+
// src/funcs/agentsStreamMessage.ts
|
|
52701
|
+
function agentsStreamMessage(client$, request, options) {
|
|
52702
|
+
return new APIPromise($do4(client$, request, options));
|
|
52703
|
+
}
|
|
52704
|
+
async function $do4(client$, request, options) {
|
|
52705
|
+
const parsed$ = safeParse4(request, (value$) => AgentAddMessageStreamRequest$zodSchema.parse(value$), "Input validation failed");
|
|
52706
|
+
if (!parsed$.ok) {
|
|
52707
|
+
return [parsed$, { status: "invalid" }];
|
|
52708
|
+
}
|
|
52709
|
+
const payload$ = parsed$.value;
|
|
52710
|
+
const body$ = encodeJSON("body", payload$.body, { explode: true });
|
|
52711
|
+
const pathParams$ = {
|
|
52712
|
+
agentKey: encodeSimple("agentKey", payload$.agentKey, {
|
|
52713
|
+
explode: false,
|
|
52714
|
+
charEncoding: "percent"
|
|
52715
|
+
}),
|
|
52716
|
+
conversationId: encodeSimple("conversationId", payload$.conversationId, {
|
|
52717
|
+
explode: false,
|
|
52718
|
+
charEncoding: "percent"
|
|
52719
|
+
})
|
|
52720
|
+
};
|
|
52721
|
+
const path$ = pathToFunc("/agents/{agentKey}/conversations/{conversationId}/messages/stream")(pathParams$);
|
|
52722
|
+
const headers$ = new Headers(compactMap({
|
|
52723
|
+
"Content-Type": "application/json",
|
|
52724
|
+
Accept: "text/event-stream"
|
|
52725
|
+
}));
|
|
52726
|
+
const securityInput = await extractSecurity(client$._options.security);
|
|
52727
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
52728
|
+
const context = {
|
|
52729
|
+
options: client$._options,
|
|
52730
|
+
baseURL: options?.serverURL ?? client$._baseURL ?? "",
|
|
52731
|
+
operationID: "streamAgentConversationMessage",
|
|
52732
|
+
oAuth2Scopes: ["agent:execute"],
|
|
52733
|
+
resolvedSecurity: requestSecurity,
|
|
52734
|
+
securitySource: client$._options.security,
|
|
52735
|
+
retryConfig: options?.retries || client$._options.retryConfig || { strategy: "none" },
|
|
52736
|
+
retryCodes: options?.retryCodes || [
|
|
52737
|
+
"429",
|
|
52738
|
+
"500",
|
|
52739
|
+
"502",
|
|
52740
|
+
"503",
|
|
52741
|
+
"504"
|
|
52742
|
+
]
|
|
52743
|
+
};
|
|
52744
|
+
const requestRes = client$._createRequest(context, {
|
|
52745
|
+
security: requestSecurity,
|
|
52746
|
+
method: "POST",
|
|
52747
|
+
baseURL: options?.serverURL,
|
|
52748
|
+
path: path$,
|
|
52749
|
+
headers: headers$,
|
|
52750
|
+
body: body$,
|
|
52751
|
+
userAgent: client$._options.userAgent,
|
|
52752
|
+
timeoutMs: options?.timeoutMs || -1
|
|
52753
|
+
}, options);
|
|
52754
|
+
if (!requestRes.ok) {
|
|
52755
|
+
return [requestRes, { status: "invalid" }];
|
|
52756
|
+
}
|
|
52757
|
+
const req$ = requestRes.value;
|
|
52758
|
+
const doResult = await client$._do(req$, {
|
|
52759
|
+
context,
|
|
52760
|
+
errorCodes: [],
|
|
52761
|
+
retryConfig: context.retryConfig,
|
|
52762
|
+
retryCodes: context.retryCodes
|
|
52763
|
+
});
|
|
52764
|
+
if (!doResult.ok) {
|
|
52765
|
+
return [doResult, { status: "request-error", request: req$ }];
|
|
52766
|
+
}
|
|
52767
|
+
return [doResult, {
|
|
52768
|
+
status: "complete",
|
|
52769
|
+
request: req$,
|
|
52770
|
+
response: doResult.value
|
|
52771
|
+
}];
|
|
52772
|
+
}
|
|
52773
|
+
var init_agentsStreamMessage = __esm(() => {
|
|
52774
|
+
init_encodings();
|
|
52775
|
+
init_primitives();
|
|
52776
|
+
init_schemas4();
|
|
52777
|
+
init_security2();
|
|
52778
|
+
init_url();
|
|
52779
|
+
init_agentops();
|
|
52780
|
+
init_async();
|
|
52781
|
+
});
|
|
52782
|
+
|
|
52783
|
+
// src/funcs/agentsListAgents.ts
|
|
52784
|
+
function agentsListAgents(client$, request, options) {
|
|
52785
|
+
return new APIPromise($do5(client$, request, options));
|
|
52786
|
+
}
|
|
52787
|
+
async function $do5(client$, request, options) {
|
|
52788
|
+
const parsed$ = safeParse4(request, (value$) => ListAgentsRequest$zodSchema.optional().parse(value$), "Input validation failed");
|
|
52789
|
+
if (!parsed$.ok) {
|
|
52790
|
+
return [parsed$, { status: "invalid" }];
|
|
52791
|
+
}
|
|
52792
|
+
const payload$ = parsed$.value;
|
|
52793
|
+
const body$ = null;
|
|
52794
|
+
const path$ = pathToFunc("/agents")();
|
|
52795
|
+
const query$ = encodeFormQuery({
|
|
52796
|
+
page: payload$?.page,
|
|
52797
|
+
limit: payload$?.limit,
|
|
52798
|
+
search: payload$?.search,
|
|
52799
|
+
sort_by: payload$?.sortBy,
|
|
52800
|
+
sort_order: payload$?.sortOrder
|
|
52801
|
+
});
|
|
52802
|
+
const headers$ = new Headers(compactMap({
|
|
52803
|
+
Accept: "application/json"
|
|
52804
|
+
}));
|
|
52805
|
+
const securityInput = await extractSecurity(client$._options.security);
|
|
52806
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
52807
|
+
const context = {
|
|
52808
|
+
options: client$._options,
|
|
52809
|
+
baseURL: options?.serverURL ?? client$._baseURL ?? "",
|
|
52810
|
+
operationID: "listAgents",
|
|
52811
|
+
oAuth2Scopes: ["agent:read"],
|
|
52812
|
+
resolvedSecurity: requestSecurity,
|
|
52813
|
+
securitySource: client$._options.security,
|
|
52814
|
+
retryConfig: options?.retries || client$._options.retryConfig || { strategy: "none" },
|
|
52815
|
+
retryCodes: options?.retryCodes || [
|
|
52816
|
+
"429",
|
|
52817
|
+
"500",
|
|
52818
|
+
"502",
|
|
52819
|
+
"503",
|
|
52820
|
+
"504"
|
|
52821
|
+
]
|
|
52822
|
+
};
|
|
52823
|
+
const requestRes = client$._createRequest(context, {
|
|
52824
|
+
security: requestSecurity,
|
|
52825
|
+
method: "GET",
|
|
52826
|
+
baseURL: options?.serverURL,
|
|
52827
|
+
path: path$,
|
|
52828
|
+
headers: headers$,
|
|
52829
|
+
query: query$,
|
|
52830
|
+
body: body$,
|
|
52831
|
+
userAgent: client$._options.userAgent,
|
|
52832
|
+
timeoutMs: options?.timeoutMs || client$._options.timeoutMs || -1
|
|
52833
|
+
}, options);
|
|
52834
|
+
if (!requestRes.ok) {
|
|
52835
|
+
return [requestRes, { status: "invalid" }];
|
|
52836
|
+
}
|
|
52837
|
+
const req$ = requestRes.value;
|
|
52838
|
+
const doResult = await client$._do(req$, {
|
|
52839
|
+
context,
|
|
52840
|
+
errorCodes: [],
|
|
52841
|
+
retryConfig: context.retryConfig,
|
|
52842
|
+
retryCodes: context.retryCodes
|
|
52843
|
+
});
|
|
52844
|
+
if (!doResult.ok) {
|
|
52845
|
+
return [doResult, { status: "request-error", request: req$ }];
|
|
52846
|
+
}
|
|
52847
|
+
return [doResult, {
|
|
52848
|
+
status: "complete",
|
|
52849
|
+
request: req$,
|
|
52850
|
+
response: doResult.value
|
|
52851
|
+
}];
|
|
52852
|
+
}
|
|
52853
|
+
var init_agentsListAgents = __esm(() => {
|
|
52854
|
+
init_encodings();
|
|
52855
|
+
init_primitives();
|
|
52856
|
+
init_schemas4();
|
|
52857
|
+
init_security2();
|
|
52858
|
+
init_url();
|
|
52859
|
+
init_agentops();
|
|
52860
|
+
init_async();
|
|
52861
|
+
});
|
|
52862
|
+
|
|
52463
52863
|
// src/mcp-server/tools/_helpers.ts
|
|
52464
52864
|
async function readJson(response) {
|
|
52465
52865
|
const text = await response.text();
|
|
@@ -52501,6 +52901,52 @@ function errorResult(message) {
|
|
|
52501
52901
|
isError: true
|
|
52502
52902
|
};
|
|
52503
52903
|
}
|
|
52904
|
+
async function httpErrorResult(response, context) {
|
|
52905
|
+
if (response.ok)
|
|
52906
|
+
return null;
|
|
52907
|
+
let body = "";
|
|
52908
|
+
try {
|
|
52909
|
+
body = await response.text();
|
|
52910
|
+
} catch {}
|
|
52911
|
+
let message = body;
|
|
52912
|
+
if (body) {
|
|
52913
|
+
try {
|
|
52914
|
+
const parsed = JSON.parse(body);
|
|
52915
|
+
const candidate = typeof parsed?.message === "string" && parsed.message || typeof parsed?.error === "string" && parsed.error || typeof parsed?.error?.message === "string" && parsed.error.message || typeof parsed?.detail === "string" && parsed.detail || "";
|
|
52916
|
+
message = candidate || body;
|
|
52917
|
+
} catch {}
|
|
52918
|
+
}
|
|
52919
|
+
const detail = message ? ` ${message.slice(0, 400)}` : "";
|
|
52920
|
+
const auth = response.status === 401 || response.status === 403 ? " Check that the bearer token / credentials are valid and not expired." : "";
|
|
52921
|
+
return errorResult(`${context} failed (HTTP ${response.status} ${response.statusText}).${detail}${auth}`);
|
|
52922
|
+
}
|
|
52923
|
+
async function readValidated(response, schema) {
|
|
52924
|
+
const text = await response.text();
|
|
52925
|
+
if (!text) {
|
|
52926
|
+
return { ok: false, result: errorResult("Empty response from server") };
|
|
52927
|
+
}
|
|
52928
|
+
let json;
|
|
52929
|
+
try {
|
|
52930
|
+
json = JSON.parse(text);
|
|
52931
|
+
} catch (e) {
|
|
52932
|
+
return {
|
|
52933
|
+
ok: false,
|
|
52934
|
+
result: errorResult(`Failed to parse response as JSON: ${e.message}` + `
|
|
52935
|
+
|
|
52936
|
+
Raw body:
|
|
52937
|
+
${text.slice(0, 500)}`)
|
|
52938
|
+
};
|
|
52939
|
+
}
|
|
52940
|
+
const parsed = schema.safeParse(json);
|
|
52941
|
+
if (!parsed.success) {
|
|
52942
|
+
return {
|
|
52943
|
+
ok: false,
|
|
52944
|
+
result: errorResult(`Unexpected response shape:
|
|
52945
|
+
${prettifyError(parsed.error)}`)
|
|
52946
|
+
};
|
|
52947
|
+
}
|
|
52948
|
+
return { ok: true, value: parsed.data };
|
|
52949
|
+
}
|
|
52504
52950
|
async function resolveSecurity2(client) {
|
|
52505
52951
|
const sec = client._options.security;
|
|
52506
52952
|
if (typeof sec === "function") {
|
|
@@ -52639,6 +53085,63 @@ async function* iterateSSE(response) {
|
|
|
52639
53085
|
} catch {}
|
|
52640
53086
|
}
|
|
52641
53087
|
}
|
|
53088
|
+
function trimAgent(a) {
|
|
53089
|
+
return {
|
|
53090
|
+
agentId: a._key,
|
|
53091
|
+
name: a.name,
|
|
53092
|
+
description: a.description ?? null,
|
|
53093
|
+
systemPrompt: a.systemPrompt ?? null,
|
|
53094
|
+
startMessage: a.startMessage ?? null,
|
|
53095
|
+
tags: a.tags,
|
|
53096
|
+
webSearch: !!a.webSearch,
|
|
53097
|
+
isActive: a.isActive,
|
|
53098
|
+
toolsets: a.toolsets.map((ts) => ({
|
|
53099
|
+
name: ts.name,
|
|
53100
|
+
tools: ts.tools.map((t) => t.fullName ?? t.name).filter((id) => typeof id === "string")
|
|
53101
|
+
})),
|
|
53102
|
+
knowledge: a.knowledge.map((k) => ({
|
|
53103
|
+
name: k.name ?? k.displayName,
|
|
53104
|
+
type: k.type
|
|
53105
|
+
}))
|
|
53106
|
+
};
|
|
53107
|
+
}
|
|
53108
|
+
async function listAllAgents(client, opts = {}) {
|
|
53109
|
+
const PAGE_SIZE = 200;
|
|
53110
|
+
const maxPages = opts.maxPages ?? 25;
|
|
53111
|
+
const reqOptions = opts.signal ? { fetchOptions: { signal: opts.signal } } : {};
|
|
53112
|
+
const all = [];
|
|
53113
|
+
let total = 0;
|
|
53114
|
+
for (let page = 1;page <= maxPages; page++) {
|
|
53115
|
+
const [r] = await agentsListAgents(client, {
|
|
53116
|
+
page,
|
|
53117
|
+
limit: PAGE_SIZE,
|
|
53118
|
+
search: opts.search
|
|
53119
|
+
}, reqOptions).$inspect();
|
|
53120
|
+
if (!r.ok)
|
|
53121
|
+
return { ok: false, result: errorResult(r.error.message) };
|
|
53122
|
+
const httpErr = await httpErrorResult(r.value, "Agent list request");
|
|
53123
|
+
if (httpErr)
|
|
53124
|
+
return { ok: false, result: httpErr };
|
|
53125
|
+
const parsed = await readValidated(r.value, AgentListEnvelope$zodSchema);
|
|
53126
|
+
if (!parsed.ok)
|
|
53127
|
+
return { ok: false, result: parsed.result };
|
|
53128
|
+
if (parsed.value.success === false) {
|
|
53129
|
+
return {
|
|
53130
|
+
ok: false,
|
|
53131
|
+
result: errorResult("Agent list request returned success: false")
|
|
53132
|
+
};
|
|
53133
|
+
}
|
|
53134
|
+
const agents = parsed.value.agents;
|
|
53135
|
+
all.push(...agents);
|
|
53136
|
+
const pg = parsed.value.pagination;
|
|
53137
|
+
total = pg?.totalItems ?? pg?.total ?? all.length;
|
|
53138
|
+
const hasNext = pg?.hasNext ?? pg?.hasNextPage ?? agents.length >= PAGE_SIZE;
|
|
53139
|
+
if (!hasNext || agents.length === 0) {
|
|
53140
|
+
return { ok: true, agents: all, total, truncated: false };
|
|
53141
|
+
}
|
|
53142
|
+
}
|
|
53143
|
+
return { ok: true, agents: all, total: total || all.length, truncated: true };
|
|
53144
|
+
}
|
|
52642
53145
|
function trimSearchHit(hit) {
|
|
52643
53146
|
const md = hit?.metadata ?? {};
|
|
52644
53147
|
return {
|
|
@@ -52653,6 +53156,11 @@ function trimSearchHit(hit) {
|
|
|
52653
53156
|
pageNum: md.pageNum
|
|
52654
53157
|
};
|
|
52655
53158
|
}
|
|
53159
|
+
var init__helpers = __esm(() => {
|
|
53160
|
+
init_zod();
|
|
53161
|
+
init_agentsListAgents();
|
|
53162
|
+
init_agentops();
|
|
53163
|
+
});
|
|
52656
53164
|
|
|
52657
53165
|
// src/mcp-server/tools/pipeshubChat.ts
|
|
52658
53166
|
var FiltersShape, args, tool$pipeshubChat;
|
|
@@ -52660,6 +53168,9 @@ var init_pipeshubChat = __esm(() => {
|
|
|
52660
53168
|
init_zod();
|
|
52661
53169
|
init_conversationsStreamConversation();
|
|
52662
53170
|
init_conversationsStreamMessage();
|
|
53171
|
+
init_agentsStreamConversation();
|
|
53172
|
+
init_agentsStreamMessage();
|
|
53173
|
+
init__helpers();
|
|
52663
53174
|
FiltersShape = object({
|
|
52664
53175
|
apps: array(string2()).optional().describe("Source-scoping ids. Mix connector instance UUIDs with the synthetic " + "`knowledgeBase_<orgId>` id (use pipeshub_sources to discover them). " + "Empty / omitted means no app-side restriction."),
|
|
52665
53176
|
kb: array(string2()).optional().describe("Legacy / unused. Leave empty.")
|
|
@@ -52671,24 +53182,38 @@ var init_pipeshubChat = __esm(() => {
|
|
|
52671
53182
|
modelKey: string2().optional().describe("Model id to use (from `pipeshub_sources` `models[*].modelKey`). " + "Defaults to the org's default LLM."),
|
|
52672
53183
|
modelName: string2().optional(),
|
|
52673
53184
|
modelFriendlyName: string2().optional(),
|
|
52674
|
-
|
|
53185
|
+
agentId: string2().optional().describe("Optional PipesHub agent to converse with — the `agentId` from " + "`pipeshub_agents`. When set, this turn runs against that agent's " + "configuration (prompt, tools, knowledge). On follow-up turns pass the " + "SAME `agentId` together with the `conversationId` returned by the " + "previous call. Omit for a plain (non-agent) conversation. If unsure " + "which agent to use, call `pipeshub_agents` first to see the options."),
|
|
53186
|
+
chatMode: _enum([
|
|
53187
|
+
"internal_search",
|
|
53188
|
+
"web_search",
|
|
53189
|
+
"auto",
|
|
53190
|
+
"quick",
|
|
53191
|
+
"verification",
|
|
53192
|
+
"deep"
|
|
53193
|
+
]).optional().describe("Response strategy. The valid values depend on whether `agentId` is set:\n" + "- WITHOUT `agentId` (plain chat): `internal_search` — answer from the " + "org's indexed knowledge (default) — or `web_search` — answer from the " + `live web.
|
|
53194
|
+
` + "- WITH `agentId` (agent chat): `auto` (let the agent decide; default), " + "`quick`, `verification`, or `deep`.")
|
|
52675
53195
|
};
|
|
52676
53196
|
tool$pipeshubChat = {
|
|
52677
53197
|
name: "pipeshub_chat",
|
|
52678
|
-
description: `**
|
|
52679
|
-
|
|
52680
|
-
|
|
52681
|
-
|
|
52682
|
-
|
|
52683
|
-
|
|
52684
|
-
returns citations.
|
|
53198
|
+
description: `**Primary chat tool — handles both internal knowledge queries and web search.**
|
|
53199
|
+
|
|
53200
|
+
**Internal search** (default, \`chatMode: "internal_search"\`): Use whenever
|
|
53201
|
+
the user asks about their documents, files, knowledge base, company policies,
|
|
53202
|
+
or anything that could plausibly be answered by content in their PipesHub-indexed
|
|
53203
|
+
sources (Drive, Box, Confluence, Slack, Gmail, Jira, the org's KB, ...).
|
|
53204
|
+
Grounds the answer in the user's actual data and returns citations.
|
|
53205
|
+
|
|
53206
|
+
**Web search** (\`chatMode: "web_search"\`): Use when the user asks about
|
|
53207
|
+
current events, public information, or anything unlikely to be in the org's
|
|
53208
|
+
internal knowledge base. Pass \`chatMode: "web_search"\` and this tool will
|
|
53209
|
+
search the public web instead.
|
|
52685
53210
|
|
|
52686
53211
|
**When to pick this over other tools:**
|
|
52687
|
-
- "What does <document> say about X?" → \`pipeshub_chat\` (
|
|
52688
|
-
|
|
52689
|
-
- "
|
|
52690
|
-
- "What's
|
|
52691
|
-
- "What
|
|
53212
|
+
- "What does <document> say about X?" → \`pipeshub_chat\` (internal_search)
|
|
53213
|
+
- "Summarize <topic / doc>." → \`pipeshub_chat\` (internal_search)
|
|
53214
|
+
- "What's our policy on Y?" → \`pipeshub_chat\` (internal_search)
|
|
53215
|
+
- "What's in the news about Z?" → \`pipeshub_chat\` (web_search)
|
|
53216
|
+
- "What is the latest version of <library>?" → \`pipeshub_chat\` (web_search)
|
|
52692
53217
|
- "Find / locate the file named X" → \`pipeshub_search\` (then
|
|
52693
53218
|
\`pipeshub_download_record\` if the user wants the bytes).
|
|
52694
53219
|
|
|
@@ -52719,7 +53244,40 @@ cited document, take \`citations[*].recordId\` and call
|
|
|
52719
53244
|
tool: async (client, args2, ctx) => {
|
|
52720
53245
|
const fetchOptions = { signal: ctx.signal };
|
|
52721
53246
|
let response;
|
|
52722
|
-
if (args2.
|
|
53247
|
+
if (args2.agentId) {
|
|
53248
|
+
const agentChatMode = args2.chatMode ?? "auto";
|
|
53249
|
+
if (args2.conversationId) {
|
|
53250
|
+
const [result] = await agentsStreamMessage(client, {
|
|
53251
|
+
agentKey: args2.agentId,
|
|
53252
|
+
conversationId: args2.conversationId,
|
|
53253
|
+
body: {
|
|
53254
|
+
query: args2.query,
|
|
53255
|
+
modelKey: args2.modelKey,
|
|
53256
|
+
modelName: args2.modelName,
|
|
53257
|
+
modelFriendlyName: args2.modelFriendlyName,
|
|
53258
|
+
chatMode: agentChatMode
|
|
53259
|
+
}
|
|
53260
|
+
}, { fetchOptions }).$inspect();
|
|
53261
|
+
if (!result.ok)
|
|
53262
|
+
return errorResult(result.error.message);
|
|
53263
|
+
response = result.value;
|
|
53264
|
+
} else {
|
|
53265
|
+
const [result] = await agentsStreamConversation(client, {
|
|
53266
|
+
agentKey: args2.agentId,
|
|
53267
|
+
body: {
|
|
53268
|
+
query: args2.query,
|
|
53269
|
+
filters: args2.filters,
|
|
53270
|
+
modelKey: args2.modelKey,
|
|
53271
|
+
modelName: args2.modelName,
|
|
53272
|
+
modelFriendlyName: args2.modelFriendlyName,
|
|
53273
|
+
chatMode: agentChatMode
|
|
53274
|
+
}
|
|
53275
|
+
}, { fetchOptions }).$inspect();
|
|
53276
|
+
if (!result.ok)
|
|
53277
|
+
return errorResult(result.error.message);
|
|
53278
|
+
response = result.value;
|
|
53279
|
+
}
|
|
53280
|
+
} else if (args2.conversationId) {
|
|
52723
53281
|
const [result] = await conversationsStreamMessage(client, {
|
|
52724
53282
|
conversationId: args2.conversationId,
|
|
52725
53283
|
body: {
|
|
@@ -52727,7 +53285,7 @@ cited document, take \`citations[*].recordId\` and call
|
|
|
52727
53285
|
modelKey: args2.modelKey,
|
|
52728
53286
|
modelName: args2.modelName,
|
|
52729
53287
|
modelFriendlyName: args2.modelFriendlyName,
|
|
52730
|
-
chatMode: args2.chatMode
|
|
53288
|
+
chatMode: args2.chatMode ?? "internal_search"
|
|
52731
53289
|
}
|
|
52732
53290
|
}, { fetchOptions }).$inspect();
|
|
52733
53291
|
if (!result.ok)
|
|
@@ -52740,12 +53298,15 @@ cited document, take \`citations[*].recordId\` and call
|
|
|
52740
53298
|
modelKey: args2.modelKey,
|
|
52741
53299
|
modelName: args2.modelName,
|
|
52742
53300
|
modelFriendlyName: args2.modelFriendlyName,
|
|
52743
|
-
chatMode: args2.chatMode
|
|
53301
|
+
chatMode: args2.chatMode ?? "internal_search"
|
|
52744
53302
|
}, { fetchOptions }).$inspect();
|
|
52745
53303
|
if (!result.ok)
|
|
52746
53304
|
return errorResult(result.error.message);
|
|
52747
53305
|
response = result.value;
|
|
52748
53306
|
}
|
|
53307
|
+
const httpErr = await httpErrorResult(response, "PipesHub chat request");
|
|
53308
|
+
if (httpErr)
|
|
53309
|
+
return httpErr;
|
|
52749
53310
|
let finalConversation = null;
|
|
52750
53311
|
let recordsUsed;
|
|
52751
53312
|
let lastAccumulated = null;
|
|
@@ -52869,9 +53430,9 @@ knowledge base, department, module, or record type. See
|
|
|
52869
53430
|
|
|
52870
53431
|
// src/funcs/semanticSearchSearch.ts
|
|
52871
53432
|
function semanticSearchSearch(client$, request, options) {
|
|
52872
|
-
return new APIPromise($
|
|
53433
|
+
return new APIPromise($do6(client$, request, options));
|
|
52873
53434
|
}
|
|
52874
|
-
async function $
|
|
53435
|
+
async function $do6(client$, request, options) {
|
|
52875
53436
|
const parsed$ = safeParse4(request, (value$) => SemanticSearchRequest$zodSchema.parse(value$), "Input validation failed");
|
|
52876
53437
|
if (!parsed$.ok) {
|
|
52877
53438
|
return [parsed$, { status: "invalid" }];
|
|
@@ -52945,6 +53506,7 @@ var args2, tool$pipeshubSearch;
|
|
|
52945
53506
|
var init_pipeshubSearch = __esm(() => {
|
|
52946
53507
|
init_zod();
|
|
52947
53508
|
init_semanticSearchSearch();
|
|
53509
|
+
init__helpers();
|
|
52948
53510
|
args2 = {
|
|
52949
53511
|
query: string2().min(1).describe("Natural language query. Vector search across the org's indexed records."),
|
|
52950
53512
|
limit: number2().int().min(1).max(100).optional().describe("Max number of result chunks. Default 10. Use a small value (5–10) " + "when the goal is to resolve a filename / topic into a recordId."),
|
|
@@ -53049,9 +53611,9 @@ on this record's knowledge base.
|
|
|
53049
53611
|
|
|
53050
53612
|
// src/funcs/recordsStreamRecordBuffer.ts
|
|
53051
53613
|
function recordsStreamRecordBuffer(client$, request, options) {
|
|
53052
|
-
return new APIPromise($
|
|
53614
|
+
return new APIPromise($do7(client$, request, options));
|
|
53053
53615
|
}
|
|
53054
|
-
async function $
|
|
53616
|
+
async function $do7(client$, request, options) {
|
|
53055
53617
|
const parsed$ = safeParse4(request, (value$) => StreamRecordBufferRequest$zodSchema.parse(value$), "Input validation failed");
|
|
53056
53618
|
if (!parsed$.ok) {
|
|
53057
53619
|
return [parsed$, { status: "invalid" }];
|
|
@@ -53135,6 +53697,7 @@ var init_pipeshubDownloadRecord = __esm(() => {
|
|
|
53135
53697
|
init_zod();
|
|
53136
53698
|
init_recordsStreamRecordBuffer();
|
|
53137
53699
|
init_tools();
|
|
53700
|
+
init__helpers();
|
|
53138
53701
|
args3 = {
|
|
53139
53702
|
recordId: string2().min(1).describe("Record identifier — usually a UUID for connector-sourced records or " + "a 24-character ObjectId for uploaded records. Get it from a chat " + "citation (`citations[*].recordId`) or from a `pipeshub_search` hit."),
|
|
53140
53703
|
convertTo: string2().optional().describe("Optional server-side format conversion target (e.g. `pdf`). When " + "omitted, the original file bytes are returned.")
|
|
@@ -53187,9 +53750,9 @@ var init_getallusersop = __esm(() => {
|
|
|
53187
53750
|
|
|
53188
53751
|
// src/funcs/usersGetAllUsers.ts
|
|
53189
53752
|
function usersGetAllUsers(client$, request, options) {
|
|
53190
|
-
return new APIPromise($
|
|
53753
|
+
return new APIPromise($do8(client$, request, options));
|
|
53191
53754
|
}
|
|
53192
|
-
async function $
|
|
53755
|
+
async function $do8(client$, request, options) {
|
|
53193
53756
|
const parsed$ = safeParse4(request, (value$) => GetAllUsersRequest$zodSchema.optional().parse(value$), "Input validation failed");
|
|
53194
53757
|
if (!parsed$.ok) {
|
|
53195
53758
|
return [parsed$, { status: "invalid" }];
|
|
@@ -53274,9 +53837,9 @@ var init_getuserbyidop = __esm(() => {
|
|
|
53274
53837
|
|
|
53275
53838
|
// src/funcs/usersGetUserById.ts
|
|
53276
53839
|
function usersGetUserById(client$, request, options) {
|
|
53277
|
-
return new APIPromise($
|
|
53840
|
+
return new APIPromise($do9(client$, request, options));
|
|
53278
53841
|
}
|
|
53279
|
-
async function $
|
|
53842
|
+
async function $do9(client$, request, options) {
|
|
53280
53843
|
const parsed$ = safeParse4(request, (value$) => GetUserByIdRequest$zodSchema.parse(value$), "Input validation failed");
|
|
53281
53844
|
if (!parsed$.ok) {
|
|
53282
53845
|
return [parsed$, { status: "invalid" }];
|
|
@@ -53363,9 +53926,9 @@ var init_getallusergroupsop = __esm(() => {
|
|
|
53363
53926
|
|
|
53364
53927
|
// src/funcs/userGroupsGetAllUserGroups.ts
|
|
53365
53928
|
function userGroupsGetAllUserGroups(client$, request, options) {
|
|
53366
|
-
return new APIPromise($
|
|
53929
|
+
return new APIPromise($do10(client$, request, options));
|
|
53367
53930
|
}
|
|
53368
|
-
async function $
|
|
53931
|
+
async function $do10(client$, request, options) {
|
|
53369
53932
|
const parsed$ = safeParse4(request, (value$) => GetAllUserGroupsRequest$zodSchema.optional().parse(value$), "Input validation failed");
|
|
53370
53933
|
if (!parsed$.ok) {
|
|
53371
53934
|
return [parsed$, { status: "invalid" }];
|
|
@@ -53455,9 +54018,9 @@ var init_getuserteamsop = __esm(() => {
|
|
|
53455
54018
|
|
|
53456
54019
|
// src/funcs/teamsGetUserTeams.ts
|
|
53457
54020
|
function teamsGetUserTeams(client$, request, options) {
|
|
53458
|
-
return new APIPromise($
|
|
54021
|
+
return new APIPromise($do11(client$, request, options));
|
|
53459
54022
|
}
|
|
53460
|
-
async function $
|
|
54023
|
+
async function $do11(client$, request, options) {
|
|
53461
54024
|
const parsed$ = safeParse4(request, (value$) => GetUserTeamsRequest$zodSchema.optional().parse(value$), "Input validation failed");
|
|
53462
54025
|
if (!parsed$.ok) {
|
|
53463
54026
|
return [parsed$, { status: "invalid" }];
|
|
@@ -53542,6 +54105,7 @@ var init_pipeshubDirectory = __esm(() => {
|
|
|
53542
54105
|
init_usersGetUserById();
|
|
53543
54106
|
init_userGroupsGetAllUserGroups();
|
|
53544
54107
|
init_teamsGetUserTeams();
|
|
54108
|
+
init__helpers();
|
|
53545
54109
|
args4 = {
|
|
53546
54110
|
action: _enum([
|
|
53547
54111
|
"whoami",
|
|
@@ -53686,9 +54250,9 @@ var init_getknowledgehubrootnodesop = __esm(() => {
|
|
|
53686
54250
|
|
|
53687
54251
|
// src/funcs/knowledgeHubGetKnowledgeHubRootNodes.ts
|
|
53688
54252
|
function knowledgeHubGetKnowledgeHubRootNodes(client$, request, options) {
|
|
53689
|
-
return new APIPromise($
|
|
54253
|
+
return new APIPromise($do12(client$, request, options));
|
|
53690
54254
|
}
|
|
53691
|
-
async function $
|
|
54255
|
+
async function $do12(client$, request, options) {
|
|
53692
54256
|
const parsed$ = safeParse4(request, (value$) => GetKnowledgeHubRootNodesRequest$zodSchema.optional().parse(value$), "Input validation failed");
|
|
53693
54257
|
if (!parsed$.ok) {
|
|
53694
54258
|
return [parsed$, { status: "invalid" }];
|
|
@@ -53804,9 +54368,9 @@ var init_getavailablemodelsbytypeop = __esm(() => {
|
|
|
53804
54368
|
|
|
53805
54369
|
// src/funcs/aiModelsProvidersGetAvailableModelsByType.ts
|
|
53806
54370
|
function aiModelsProvidersGetAvailableModelsByType(client$, request, options) {
|
|
53807
|
-
return new APIPromise($
|
|
54371
|
+
return new APIPromise($do13(client$, request, options));
|
|
53808
54372
|
}
|
|
53809
|
-
async function $
|
|
54373
|
+
async function $do13(client$, request, options) {
|
|
53810
54374
|
const parsed$ = safeParse4(request, (value$) => GetAvailableModelsByTypeRequest$zodSchema.parse(value$), "Input validation failed");
|
|
53811
54375
|
if (!parsed$.ok) {
|
|
53812
54376
|
return [parsed$, { status: "invalid" }];
|
|
@@ -53886,6 +54450,7 @@ var init_pipeshubSources = __esm(() => {
|
|
|
53886
54450
|
init_zod();
|
|
53887
54451
|
init_knowledgeHubGetKnowledgeHubRootNodes();
|
|
53888
54452
|
init_aiModelsProvidersGetAvailableModelsByType();
|
|
54453
|
+
init__helpers();
|
|
53889
54454
|
args5 = {
|
|
53890
54455
|
include: array(_enum(["sources", "llmModels", "embeddingModels"])).optional().describe('Which sections to fetch. Default: `["sources", "llmModels"]`. ' + "Add `embeddingModels` if the user is configuring re-embedding.")
|
|
53891
54456
|
};
|
|
@@ -53969,6 +54534,99 @@ are returned by default; pass \`include\` to override.`,
|
|
|
53969
54534
|
};
|
|
53970
54535
|
});
|
|
53971
54536
|
|
|
54537
|
+
// src/mcp-server/tools/pipeshubAgents.ts
|
|
54538
|
+
var args6, tool$pipeshubAgents;
|
|
54539
|
+
var init_pipeshubAgents = __esm(() => {
|
|
54540
|
+
init_zod();
|
|
54541
|
+
init__helpers();
|
|
54542
|
+
args6 = {
|
|
54543
|
+
search: string2().optional().describe("Optional case-insensitive substring match across agent name, " + "description, and tags. Omit to return every agent.")
|
|
54544
|
+
};
|
|
54545
|
+
tool$pipeshubAgents = {
|
|
54546
|
+
name: "pipeshub_agents",
|
|
54547
|
+
description: `List the PipesHub **agents** configured for this org, each with its
|
|
54548
|
+
capabilities.
|
|
54549
|
+
|
|
54550
|
+
Agents are specialized assistants (custom system prompt, tools, knowledge
|
|
54551
|
+
scope). To converse with one, take its \`agentId\` and pass it to
|
|
54552
|
+
\`pipeshub_chat\`'s \`agentId\` argument.
|
|
54553
|
+
|
|
54554
|
+
Each agent is returned as:
|
|
54555
|
+
\`{ agentId, name, description, systemPrompt, startMessage, tags, webSearch,
|
|
54556
|
+
isActive, toolsets, knowledge }\`.
|
|
54557
|
+
- \`toolsets\` — what the agent can DO: each \`{ name, tools }\` where \`name\`
|
|
54558
|
+
is the connector (e.g. \`jira\`, \`gmail\`) and \`tools\` are the runnable
|
|
54559
|
+
tool ids (e.g. \`jira.create_issue\`, \`gmail.send_email\`).
|
|
54560
|
+
- \`knowledge\` — what the agent can READ: each \`{ name, type }\` (e.g.
|
|
54561
|
+
\`Confluence-2\` / \`Confluence\`).
|
|
54562
|
+
|
|
54563
|
+
**Route on \`toolsets\`/\`knowledge\`, not the name** — names and descriptions
|
|
54564
|
+
are often generic or misleading. Match the request to the agent whose tools can
|
|
54565
|
+
actually perform it (e.g. "create a Jira ticket" → the agent whose toolset is
|
|
54566
|
+
\`jira\` and whose tools include \`jira.create_issue\`). If NO agent has a tool
|
|
54567
|
+
for the requested action, say so — don't force an unrelated agent.
|
|
54568
|
+
|
|
54569
|
+
The list **may be empty** (no agents configured). For plain Q&A when no
|
|
54570
|
+
specific agent is needed, use \`pipeshub_chat\` WITHOUT \`agentId\` and pick a
|
|
54571
|
+
\`chatMode\`: \`internal_search\` (org's indexed knowledge) or \`web_search\`
|
|
54572
|
+
(live web). Use \`agentId\` everywhere an agent is referenced.`,
|
|
54573
|
+
scopes: ["read"],
|
|
54574
|
+
annotations: {
|
|
54575
|
+
title: "List PipesHub agents (with toolsets & knowledge)",
|
|
54576
|
+
destructiveHint: false,
|
|
54577
|
+
idempotentHint: true,
|
|
54578
|
+
openWorldHint: false,
|
|
54579
|
+
readOnlyHint: true
|
|
54580
|
+
},
|
|
54581
|
+
args: args6,
|
|
54582
|
+
tool: async (client, args7, ctx) => {
|
|
54583
|
+
const all = await listAllAgents(client, {
|
|
54584
|
+
search: args7.search,
|
|
54585
|
+
signal: ctx.signal
|
|
54586
|
+
});
|
|
54587
|
+
if (!all.ok)
|
|
54588
|
+
return all.result;
|
|
54589
|
+
return jsonResult({
|
|
54590
|
+
agents: all.agents.map(trimAgent),
|
|
54591
|
+
total: all.total,
|
|
54592
|
+
...all.truncated ? { truncated: true } : {}
|
|
54593
|
+
});
|
|
54594
|
+
}
|
|
54595
|
+
};
|
|
54596
|
+
});
|
|
54597
|
+
|
|
54598
|
+
// src/mcp-server/prompts/pipeshubAssistant.ts
|
|
54599
|
+
var args7, prompt$pipeshubAssistant;
|
|
54600
|
+
var init_pipeshubAssistant = __esm(() => {
|
|
54601
|
+
init_zod();
|
|
54602
|
+
args7 = {
|
|
54603
|
+
query: string2().optional().describe("Optional. The user's request to route. Provide it to have the guidance " + "applied to a concrete request; omit it to just load the routing " + "guidance as a seed system prompt at the start of a session.")
|
|
54604
|
+
};
|
|
54605
|
+
prompt$pipeshubAssistant = {
|
|
54606
|
+
name: "pipeshub-assistant",
|
|
54607
|
+
description: "Load PipesHub tool-routing guidance so the assistant picks the correct " + "tool (pipeshub_chat / search / agents / directory) and lists agents " + "with pipeshub_agents when unsure which route fits the query.",
|
|
54608
|
+
scopes: ["read"],
|
|
54609
|
+
args: args7,
|
|
54610
|
+
prompt: (_client, args8, _extra) => {
|
|
54611
|
+
const text = args8.query ? `${PIPESHUB_INSTRUCTIONS}
|
|
54612
|
+
|
|
54613
|
+
---
|
|
54614
|
+
|
|
54615
|
+
Follow the routing rules above to ` + `handle this request, picking the right tool (and listing agents via ` + `\`pipeshub_agents\` if unsure which route fits):
|
|
54616
|
+
|
|
54617
|
+
${args8.query}` : PIPESHUB_INSTRUCTIONS;
|
|
54618
|
+
return {
|
|
54619
|
+
messages: [
|
|
54620
|
+
{
|
|
54621
|
+
role: "user",
|
|
54622
|
+
content: { type: "text", text }
|
|
54623
|
+
}
|
|
54624
|
+
]
|
|
54625
|
+
};
|
|
54626
|
+
}
|
|
54627
|
+
};
|
|
54628
|
+
});
|
|
54629
|
+
|
|
53972
54630
|
// src/mcp-server/server.ts
|
|
53973
54631
|
function createMCPServer(deps) {
|
|
53974
54632
|
const server = new McpServer({
|
|
@@ -53983,9 +54641,9 @@ function createMCPServer(deps) {
|
|
|
53983
54641
|
serverIdx: deps.serverIdx,
|
|
53984
54642
|
instance_url: deps.instance_url,
|
|
53985
54643
|
debugLogger: deps.logger.level === "debug" ? {
|
|
53986
|
-
log: (...
|
|
53987
|
-
group: (...
|
|
53988
|
-
groupEnd: (...
|
|
54644
|
+
log: (...args8) => console.log(...args8),
|
|
54645
|
+
group: (...args8) => console.group(...args8),
|
|
54646
|
+
groupEnd: (...args8) => console.groupEnd(...args8)
|
|
53989
54647
|
} : undefined
|
|
53990
54648
|
}));
|
|
53991
54649
|
const scopes = new Set(deps.scopes);
|
|
@@ -54000,63 +54658,13 @@ function createMCPServer(deps) {
|
|
|
54000
54658
|
tool(tool$pipeshubSearch);
|
|
54001
54659
|
tool(tool$pipeshubDownloadRecord);
|
|
54002
54660
|
tool(tool$pipeshubDirectory);
|
|
54661
|
+
tool(tool$pipeshubAgents);
|
|
54662
|
+
prompt(prompt$pipeshubAssistant);
|
|
54003
54663
|
if (deps.dynamic) {
|
|
54004
54664
|
registerDynamicTools(deps.logger, server, getClient, toolMap, scopes);
|
|
54005
54665
|
}
|
|
54006
54666
|
return { server, tools };
|
|
54007
54667
|
}
|
|
54008
|
-
var PIPESHUB_INSTRUCTIONS = `# PipesHub MCP — instructions for the LLM
|
|
54009
|
-
|
|
54010
|
-
PipesHub is the user's workplace AI platform. It indexes their documents,
|
|
54011
|
-
knowledge base content, and connector sources (Drive, Box, Confluence,
|
|
54012
|
-
Slack, Jira, Gmail, ...). When in doubt, the answer is in PipesHub.
|
|
54013
|
-
|
|
54014
|
-
## Default tool: \`pipeshub_chat\`
|
|
54015
|
-
|
|
54016
|
-
**Use \`pipeshub_chat\` for any question that could plausibly be answered
|
|
54017
|
-
by the user's PipesHub-indexed data.** That includes:
|
|
54018
|
-
|
|
54019
|
-
- Anything about a specific document, file, report, ticket, message, or
|
|
54020
|
-
page (e.g. "what's in the Q4 sales report?", "summarize the langchain
|
|
54021
|
-
doc", "what did Aashil say about onboarding?").
|
|
54022
|
-
- Anything about company / org policies, processes, decisions, or
|
|
54023
|
-
history (e.g. "what's our vacation policy?", "who owns the auth
|
|
54024
|
-
service?").
|
|
54025
|
-
- Anything explicitly mentioning PipesHub itself, or its sources
|
|
54026
|
-
(Drive / Box / Confluence / Slack / Gmail / Jira / etc.) when the
|
|
54027
|
-
user has those connected.
|
|
54028
|
-
- Open-ended "what do we know about X" questions where the answer
|
|
54029
|
-
likely lives in the org's documents.
|
|
54030
|
-
|
|
54031
|
-
Do NOT answer those from your own knowledge — \`pipeshub_chat\` grounds
|
|
54032
|
-
the answer in the user's actual indexed content and returns citations
|
|
54033
|
-
the user can verify.
|
|
54034
|
-
|
|
54035
|
-
## When to use the other tools
|
|
54036
|
-
|
|
54037
|
-
- \`pipeshub_search\` — only when the user asks specifically to **find /
|
|
54038
|
-
locate** a document by name or topic (so you can hand them a list, or
|
|
54039
|
-
resolve a filename to a \`recordId\` for download). For "what does
|
|
54040
|
-
the doc say?" use \`pipeshub_chat\` instead — it does the retrieval
|
|
54041
|
-
internally.
|
|
54042
|
-
- \`pipeshub_download_record\` — when the user wants the actual file
|
|
54043
|
-
bytes (download, attach, open). Get the \`recordId\` either from
|
|
54044
|
-
citations on a prior \`pipeshub_chat\` response or from
|
|
54045
|
-
\`pipeshub_search\`.
|
|
54046
|
-
- \`pipeshub_directory\` — people, groups, teams, and \`whoami\` lookups.
|
|
54047
|
-
Not for documents.
|
|
54048
|
-
- \`pipeshub_sources\` — call once at the start of a session to discover
|
|
54049
|
-
which connectors / KB / models are available, then cache the result.
|
|
54050
|
-
|
|
54051
|
-
## Conversation lifecycle
|
|
54052
|
-
|
|
54053
|
-
\`pipeshub_chat\` is a single tool that handles both starting and
|
|
54054
|
-
continuing conversations. On the first turn omit \`conversationId\`; on
|
|
54055
|
-
every subsequent turn pass back the \`conversationId\` returned by the
|
|
54056
|
-
previous call. Server-side context is preserved — do NOT replay prior
|
|
54057
|
-
messages. Only start a fresh conversation when the user explicitly
|
|
54058
|
-
asks to clear context.
|
|
54059
|
-
`;
|
|
54060
54668
|
var init_server2 = __esm(() => {
|
|
54061
54669
|
init_mcp();
|
|
54062
54670
|
init_core3();
|
|
@@ -54067,6 +54675,8 @@ var init_server2 = __esm(() => {
|
|
|
54067
54675
|
init_pipeshubDownloadRecord();
|
|
54068
54676
|
init_pipeshubDirectory();
|
|
54069
54677
|
init_pipeshubSources();
|
|
54678
|
+
init_pipeshubAgents();
|
|
54679
|
+
init_pipeshubAssistant();
|
|
54070
54680
|
});
|
|
54071
54681
|
|
|
54072
54682
|
// src/tool-names.ts
|
|
@@ -54079,20 +54689,25 @@ var init_tool_names = __esm(() => {
|
|
|
54079
54689
|
},
|
|
54080
54690
|
{
|
|
54081
54691
|
name: "pipeshub_chat",
|
|
54082
|
-
description: `**
|
|
54083
|
-
|
|
54084
|
-
|
|
54085
|
-
|
|
54086
|
-
|
|
54087
|
-
|
|
54088
|
-
returns citations.
|
|
54692
|
+
description: `**Primary chat tool — handles both internal knowledge queries and web search.**
|
|
54693
|
+
|
|
54694
|
+
**Internal search** (default, \`chatMode: "internal_search"\`): Use whenever
|
|
54695
|
+
the user asks about their documents, files, knowledge base, company policies,
|
|
54696
|
+
or anything that could plausibly be answered by content in their PipesHub-indexed
|
|
54697
|
+
sources (Drive, Box, Confluence, Slack, Gmail, Jira, the org's KB, ...).
|
|
54698
|
+
Grounds the answer in the user's actual data and returns citations.
|
|
54699
|
+
|
|
54700
|
+
**Web search** (\`chatMode: "web_search"\`): Use when the user asks about
|
|
54701
|
+
current events, public information, or anything unlikely to be in the org's
|
|
54702
|
+
internal knowledge base. Pass \`chatMode: "web_search"\` and this tool will
|
|
54703
|
+
search the public web instead.
|
|
54089
54704
|
|
|
54090
54705
|
**When to pick this over other tools:**
|
|
54091
|
-
- "What does <document> say about X?" → \`pipeshub_chat\` (
|
|
54092
|
-
|
|
54093
|
-
- "
|
|
54094
|
-
- "What's
|
|
54095
|
-
- "What
|
|
54706
|
+
- "What does <document> say about X?" → \`pipeshub_chat\` (internal_search)
|
|
54707
|
+
- "Summarize <topic / doc>." → \`pipeshub_chat\` (internal_search)
|
|
54708
|
+
- "What's our policy on Y?" → \`pipeshub_chat\` (internal_search)
|
|
54709
|
+
- "What's in the news about Z?" → \`pipeshub_chat\` (web_search)
|
|
54710
|
+
- "What is the latest version of <library>?" → \`pipeshub_chat\` (web_search)
|
|
54096
54711
|
- "Find / locate the file named X" → \`pipeshub_search\` (then
|
|
54097
54712
|
\`pipeshub_download_record\` if the user wants the bytes).
|
|
54098
54713
|
|
|
@@ -54139,6 +54754,10 @@ Highest \`score\` first; multiple hits may share the same \`recordId\`
|
|
|
54139
54754
|
{
|
|
54140
54755
|
name: "pipeshub_directory",
|
|
54141
54756
|
description: "Look up people, groups, and teams in PipesHub. One tool with five\nactions — pick the right `action`:\n\n- `whoami` — who is the caller? Use this whenever you need the\n authenticated user's own id, email, or full name (e.g. before\n `get_user` on themselves).\n- `list_users` — search / page through org users.\n- `get_user` — full `User` document for one user (requires `userId`).\n- `list_groups` — list user groups with `userCount`.\n- `list_my_teams` — teams the caller belongs to, with capability flags\n (`canEdit` / `canDelete` / `canManageMembers`).\n\nOutput shape varies by action; see each action's docs above."
|
|
54757
|
+
},
|
|
54758
|
+
{
|
|
54759
|
+
name: "pipeshub_agents",
|
|
54760
|
+
description: 'List the PipesHub **agents** configured for this org, each with its\ncapabilities.\n\nAgents are specialized assistants (custom system prompt, tools, knowledge\nscope). To converse with one, take its `agentId` and pass it to\n`pipeshub_chat`\'s `agentId` argument.\n\nEach agent is returned as:\n`{ agentId, name, description, systemPrompt, startMessage, tags, webSearch,\nisActive, toolsets, knowledge }`.\n- `toolsets` — what the agent can DO: each `{ name, tools }` where `name`\n is the connector (e.g. `jira`, `gmail`) and `tools` are the runnable\n tool ids (e.g. `jira.create_issue`, `gmail.send_email`).\n- `knowledge` — what the agent can READ: each `{ name, type }` (e.g.\n `Confluence-2` / `Confluence`).\n\n**Route on `toolsets`/`knowledge`, not the name** — names and descriptions\nare often generic or misleading. Match the request to the agent whose tools can\nactually perform it (e.g. "create a Jira ticket" → the agent whose toolset is\n`jira` and whose tools include `jira.create_issue`). If NO agent has a tool\nfor the requested action, say so — don\'t force an unrelated agent.\n\nThe list **may be empty** (no agents configured). For plain Q&A when no\nspecific agent is needed, use `pipeshub_chat` WITHOUT `agentId` and pick a\n`chatMode`: `internal_search` (org\'s indexed knowledge) or `web_search`\n(live web). Use `agentId` everywhere an agent is referenced.'
|
|
54142
54761
|
}
|
|
54143
54762
|
];
|
|
54144
54763
|
});
|
|
@@ -57767,5 +58386,5 @@ export {
|
|
|
57767
58386
|
app
|
|
57768
58387
|
};
|
|
57769
58388
|
|
|
57770
|
-
//# debugId=
|
|
58389
|
+
//# debugId=E589470B4E3C258364756E2164756E21
|
|
57771
58390
|
//# sourceMappingURL=mcp-server.js.map
|