@tellagen/mcp-server 0.4.2 → 0.5.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/LICENSE +21 -0
- package/README.md +334 -101
- package/SKILL.md +83 -17
- package/contracts/mcp-protocol.json +155 -0
- package/contracts/runbooks/manifest.json +26 -6
- package/contracts/runbooks/v2/cause-lead.guidance.json +37 -0
- package/contracts/runbooks/v2/client-protocol.json +926 -0
- package/contracts/runbooks/v2/client-writes.guidance.json +42 -0
- package/contracts/runbooks/v2/fixtures/timeline-event-blocks-rejected.json +30 -5
- package/contracts/runbooks/v2/result-summary.guidance.json +21 -0
- package/contracts/runbooks/v2/timeline-event-blocks.schema.json +18 -11
- package/contracts/tellagen-runbook-contracts.json +4 -4
- package/dist/active-run.d.ts +29 -0
- package/dist/active-run.js +67 -0
- package/dist/active-run.js.map +1 -0
- package/dist/bootstrap.d.ts +20 -0
- package/dist/bootstrap.js +29 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/cause-lead.d.ts +25 -0
- package/dist/cause-lead.js +145 -0
- package/dist/cause-lead.js.map +1 -0
- package/dist/cli/auth.d.ts +22 -0
- package/dist/cli/auth.js +207 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/io.d.ts +16 -0
- package/dist/cli/io.js +53 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/listen-guard.d.ts +12 -0
- package/dist/cli/listen-guard.js +50 -0
- package/dist/cli/listen-guard.js.map +1 -0
- package/dist/cli/listen.d.ts +28 -0
- package/dist/cli/listen.js +205 -0
- package/dist/cli/listen.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +53 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/trace-hook.d.ts +23 -0
- package/dist/cli/trace-hook.js +99 -0
- package/dist/cli/trace-hook.js.map +1 -0
- package/dist/client.d.ts +92 -6
- package/dist/client.js +300 -23
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +17 -0
- package/dist/config.js +38 -0
- package/dist/config.js.map +1 -0
- package/dist/credentials.d.ts +120 -0
- package/dist/credentials.js +363 -0
- package/dist/credentials.js.map +1 -0
- package/dist/diagnosis-structure.d.ts +207 -147
- package/dist/diagnosis-structure.js +142 -1
- package/dist/diagnosis-structure.js.map +1 -1
- package/dist/diff-figure.d.ts +56 -0
- package/dist/diff-figure.js +276 -0
- package/dist/diff-figure.js.map +1 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.js +60 -0
- package/dist/errors.js.map +1 -1
- package/dist/figures.d.ts +281 -201
- package/dist/figures.js +189 -47
- package/dist/figures.js.map +1 -1
- package/dist/guide-resources.d.ts +28 -0
- package/dist/guide-resources.js +81 -0
- package/dist/guide-resources.js.map +1 -0
- package/dist/heartbeat.d.ts +24 -0
- package/dist/heartbeat.js +94 -0
- package/dist/heartbeat.js.map +1 -0
- package/dist/home.d.ts +8 -0
- package/dist/home.js +14 -0
- package/dist/home.js.map +1 -0
- package/dist/identity.d.ts +32 -0
- package/dist/identity.js +83 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.js +46 -14
- package/dist/index.js.map +1 -1
- package/dist/listen-config.d.ts +67 -0
- package/dist/listen-config.js +83 -0
- package/dist/listen-config.js.map +1 -0
- package/dist/listen-probe.d.ts +57 -0
- package/dist/listen-probe.js +158 -0
- package/dist/listen-probe.js.map +1 -0
- package/dist/listen-rules.d.ts +88 -0
- package/dist/listen-rules.js +252 -0
- package/dist/listen-rules.js.map +1 -0
- package/dist/listen-settings.d.ts +18 -0
- package/dist/listen-settings.js +50 -0
- package/dist/listen-settings.js.map +1 -0
- package/dist/listen-wrap.d.ts +21 -0
- package/dist/listen-wrap.js +52 -0
- package/dist/listen-wrap.js.map +1 -0
- package/dist/listener.d.ts +195 -0
- package/dist/listener.js +600 -0
- package/dist/listener.js.map +1 -0
- package/dist/open-run.d.ts +2 -0
- package/dist/open-run.js +5 -0
- package/dist/open-run.js.map +1 -0
- package/dist/prompts.d.ts +12 -0
- package/dist/prompts.js +37 -0
- package/dist/prompts.js.map +1 -0
- package/dist/redact.d.ts +13 -0
- package/dist/redact.js +76 -0
- package/dist/redact.js.map +1 -0
- package/dist/run-events.d.ts +54 -0
- package/dist/run-events.js +210 -0
- package/dist/run-events.js.map +1 -0
- package/dist/run-state.d.ts +184 -0
- package/dist/run-state.js +207 -0
- package/dist/run-state.js.map +1 -0
- package/dist/server.d.ts +22 -2
- package/dist/server.js +137 -29
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +86 -0
- package/dist/session.js +155 -0
- package/dist/session.js.map +1 -0
- package/dist/shell-rules.d.ts +49 -0
- package/dist/shell-rules.js +335 -0
- package/dist/shell-rules.js.map +1 -0
- package/dist/signin-index.d.ts +164 -0
- package/dist/signin-index.js +116 -0
- package/dist/signin-index.js.map +1 -0
- package/dist/signin.d.ts +169 -0
- package/dist/signin.js +541 -0
- package/dist/signin.js.map +1 -0
- package/dist/start.d.ts +7 -6
- package/dist/start.js +14 -7
- package/dist/start.js.map +1 -1
- package/dist/tools/catalog.d.ts +44 -0
- package/dist/tools/catalog.js +105 -0
- package/dist/tools/catalog.js.map +1 -0
- package/dist/tools/causes.d.ts +6 -6
- package/dist/tools/causes.js +4 -5
- package/dist/tools/causes.js.map +1 -1
- package/dist/tools/context.js +5 -5
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/datasources.js +1 -1
- package/dist/tools/datasources.js.map +1 -1
- package/dist/tools/diagnostics.js +2 -2
- package/dist/tools/diagnostics.js.map +1 -1
- package/dist/tools/figures.d.ts +3 -2
- package/dist/tools/figures.js +38 -13
- package/dist/tools/figures.js.map +1 -1
- package/dist/tools/findings.d.ts +28 -0
- package/dist/tools/findings.js +75 -12
- package/dist/tools/findings.js.map +1 -1
- package/dist/tools/incidents.js +5 -5
- package/dist/tools/incidents.js.map +1 -1
- package/dist/tools/index.d.ts +19 -2
- package/dist/tools/index.js +115 -14
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/investigations.d.ts +54 -0
- package/dist/tools/investigations.js +369 -68
- package/dist/tools/investigations.js.map +1 -1
- package/dist/tools/next.d.ts +20 -0
- package/dist/tools/next.js +136 -0
- package/dist/tools/next.js.map +1 -0
- package/dist/tools/postmortem-runbooks.d.ts +52 -52
- package/dist/tools/postmortem-runbooks.js +3 -10
- package/dist/tools/postmortem-runbooks.js.map +1 -1
- package/dist/tools/resume.d.ts +5 -0
- package/dist/tools/resume.js +136 -0
- package/dist/tools/resume.js.map +1 -0
- package/dist/tools/signin.d.ts +12 -0
- package/dist/tools/signin.js +54 -0
- package/dist/tools/signin.js.map +1 -0
- package/dist/tools/source-links.js +5 -3
- package/dist/tools/source-links.js.map +1 -1
- package/dist/tools/timeline.js +57 -11
- package/dist/tools/timeline.js.map +1 -1
- package/dist/trace-record.d.ts +36 -0
- package/dist/trace-record.js +283 -0
- package/dist/trace-record.js.map +1 -0
- package/dist/version.d.ts +10 -2
- package/dist/version.js +20 -1
- package/dist/version.js.map +1 -1
- package/package.json +23 -3
- package/server.json +5 -5
- package/contracts/runbooks/v1/fixtures/global-runbook.json +0 -7
- package/contracts/runbooks/v1/runbook-definition.schema.json +0 -25
- package/dist/auth.d.ts +0 -7
- package/dist/auth.js +0 -19
- package/dist/auth.js.map +0 -1
package/dist/tools/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { formatError } from "../errors.js";
|
|
3
|
+
import { markLeadsInText } from "../cause-lead.js";
|
|
4
|
+
import { decorateToolResult } from "../run-events.js";
|
|
5
|
+
import { DEFAULT_TOOLSETS, ENABLE_TOOLSET_TOOL, TOOL_CATALOG, TOOLSETS, TOOLSET_SUMMARY, toolAnnotations, } from "./catalog.js";
|
|
1
6
|
import { registerIncidentTools } from "./incidents.js";
|
|
2
7
|
import { registerInvestigationTools } from "./investigations.js";
|
|
3
8
|
import { registerCauseTools } from "./causes.js";
|
|
@@ -10,19 +15,115 @@ import { registerPostmortemRunbookTools } from "./postmortem-runbooks.js";
|
|
|
10
15
|
import { registerFigureTools } from "./figures.js";
|
|
11
16
|
import { registerSourceLinkTools } from "./source-links.js";
|
|
12
17
|
import { registerAttachmentTools } from "./attachments.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
import { registerResumeTools } from "./resume.js";
|
|
19
|
+
import { registerNextInvestigationTools } from "./next.js";
|
|
20
|
+
import { registerSignInTool } from "./signin.js";
|
|
21
|
+
/** Runs a tool only when Tellagen can be reached with a key, and adds waiting lines to its answer. */
|
|
22
|
+
function guarded(client, handler) {
|
|
23
|
+
return async (args, extra) => {
|
|
24
|
+
const problem = await client.accessProblem();
|
|
25
|
+
if (problem) {
|
|
26
|
+
return { content: [{ type: "text", text: formatError(problem) }], isError: true };
|
|
27
|
+
}
|
|
28
|
+
const named = [args?.investigation_run_id, args?.run_id].find((value) => typeof value === "string" && value.trim().length > 0);
|
|
29
|
+
const result = await handler(args, extra);
|
|
30
|
+
// Every tool answer passes here: a lead from a past incident is cleaned and marked as untrusted data.
|
|
31
|
+
for (const item of result?.content ?? []) {
|
|
32
|
+
if (item.type === "text" && typeof item.text === "string")
|
|
33
|
+
item.text = markLeadsInText(item.text);
|
|
34
|
+
}
|
|
35
|
+
return decorateToolResult(client, result, named?.trim());
|
|
36
|
+
};
|
|
27
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Register the Tellagen MCP tools on the server, in the fixed order of the
|
|
40
|
+
* catalog, each with its read-only and destructive annotations. Tools of a
|
|
41
|
+
* toolset that is off stay registered and hidden, so tellagen_enable_toolset
|
|
42
|
+
* can list them later.
|
|
43
|
+
*/
|
|
44
|
+
export function registerAllTools(server, client, options = {}) {
|
|
45
|
+
const collected = new Map();
|
|
46
|
+
const collector = {
|
|
47
|
+
registerTool(name, config, handler) {
|
|
48
|
+
if (collected.has(name))
|
|
49
|
+
throw new Error(`tool registered twice: ${name}`);
|
|
50
|
+
collected.set(name, { config, handler });
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
registerIncidentTools(collector, client);
|
|
54
|
+
registerInvestigationTools(collector, client);
|
|
55
|
+
registerFindingTools(collector, client);
|
|
56
|
+
registerCauseTools(collector, client);
|
|
57
|
+
registerTimelineTools(collector, client);
|
|
58
|
+
registerContextTools(collector, client);
|
|
59
|
+
registerDatasourceTools(collector, client);
|
|
60
|
+
registerDiagnosticTools(collector, client);
|
|
61
|
+
registerPostmortemRunbookTools(collector, client);
|
|
62
|
+
registerFigureTools(collector, client);
|
|
63
|
+
registerSourceLinkTools(collector, client);
|
|
64
|
+
registerAttachmentTools(collector, client);
|
|
65
|
+
registerResumeTools(collector, client);
|
|
66
|
+
registerNextInvestigationTools(collector, client);
|
|
67
|
+
const selection = options.toolsets ?? "all";
|
|
68
|
+
const on = new Set(selection === "all" ? TOOLSETS : selection);
|
|
69
|
+
const handles = new Map();
|
|
70
|
+
const register = server.registerTool.bind(server);
|
|
71
|
+
for (const entry of TOOL_CATALOG) {
|
|
72
|
+
const tool = collected.get(entry.name);
|
|
73
|
+
if (!tool)
|
|
74
|
+
throw new Error(`the tool catalog names a tool that is not registered: ${entry.name}`);
|
|
75
|
+
collected.delete(entry.name);
|
|
76
|
+
const handle = register(entry.name, { ...tool.config, annotations: toolAnnotations(entry) }, guarded(client, tool.handler));
|
|
77
|
+
if (!on.has(entry.toolset))
|
|
78
|
+
handle?.disable?.();
|
|
79
|
+
handles.set(entry.toolset, [...(handles.get(entry.toolset) ?? []), handle]);
|
|
80
|
+
}
|
|
81
|
+
if (collected.size > 0) {
|
|
82
|
+
throw new Error(`tools missing from the tool catalog: ${[...collected.keys()].join(", ")}`);
|
|
83
|
+
}
|
|
84
|
+
const enabled = () => TOOLSETS.filter((toolset) => on.has(toolset));
|
|
85
|
+
const enable = (toolset) => {
|
|
86
|
+
const wanted = toolset === "all" ? [...TOOLSETS] : TOOLSETS.filter((name) => name === toolset);
|
|
87
|
+
const added = [];
|
|
88
|
+
for (const name of wanted) {
|
|
89
|
+
if (on.has(name))
|
|
90
|
+
continue;
|
|
91
|
+
on.add(name);
|
|
92
|
+
added.push(name);
|
|
93
|
+
// Each handle tells the client that the tool list changed.
|
|
94
|
+
for (const handle of handles.get(name) ?? [])
|
|
95
|
+
handle?.enable?.();
|
|
96
|
+
}
|
|
97
|
+
return { enabled: enabled(), added };
|
|
98
|
+
};
|
|
99
|
+
client.session.toolsets = { enable, enabled };
|
|
100
|
+
register(ENABLE_TOOLSET_TOOL, {
|
|
101
|
+
description: `Turn on another set of Tellagen tools for this session. The client is told that the tool list changed. Sets: ${TOOLSETS.map((name) => `${name} (${TOOLSET_SUMMARY[name].replace(/\.$/, "")})`).join("; ")}; all turns every set on. It changes nothing in Tellagen.`,
|
|
102
|
+
inputSchema: {
|
|
103
|
+
toolset: z.enum([...TOOLSETS, "all"]).describe("The toolset to turn on, or all"),
|
|
104
|
+
},
|
|
105
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
106
|
+
}, async (args) => {
|
|
107
|
+
const result = enable(String(args.toolset));
|
|
108
|
+
const tools = TOOL_CATALOG.filter((entry) => result.added.includes(entry.toolset)).map((entry) => entry.name);
|
|
109
|
+
return {
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: "text",
|
|
113
|
+
text: JSON.stringify({
|
|
114
|
+
enabled_toolsets: result.enabled,
|
|
115
|
+
added_toolsets: result.added,
|
|
116
|
+
added_tools: tools,
|
|
117
|
+
message: result.added.length > 0
|
|
118
|
+
? "The tools are listed now. If your client does not show them yet, ask the person to reconnect this MCP server."
|
|
119
|
+
: "That toolset was already on.",
|
|
120
|
+
}),
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
if (options.signIn)
|
|
126
|
+
registerSignInTool(server, client, options.signIn);
|
|
127
|
+
}
|
|
128
|
+
export { DEFAULT_TOOLSETS };
|
|
28
129
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,eAAe,EAGf,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uB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,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;SACjF;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;KACxG,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9G,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,gBAAgB,EAAE,MAAM,CAAC,OAAO;wBAChC,cAAc,EAAE,MAAM,CAAC,KAAK;wBAC5B,WAAW,EAAE,KAAK;wBAClB,OAAO,EACL,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;4BACrB,CAAC,CAAC,+GAA+G;4BACjH,CAAC,CAAC,8BAA8B;qBACrC,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM;QAAE,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACzE,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,3 +1,57 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { TellagenClient } from "../client.js";
|
|
4
|
+
/** The data source kinds a client can say it has, by Tellagen catalog key. */
|
|
5
|
+
export declare const AVAILABLE_SOURCE_KEYS: readonly ["grafana", "kubernetes", "github", "docs", "local_host"];
|
|
6
|
+
declare const availableSourceSchema: z.ZodObject<{
|
|
7
|
+
key: z.ZodEnum<["grafana", "kubernetes", "github", "docs", "local_host"]>;
|
|
8
|
+
state: z.ZodEnum<["found", "not_found"]>;
|
|
9
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
state: "found" | "not_found";
|
|
12
|
+
key: "grafana" | "github" | "kubernetes" | "docs" | "local_host";
|
|
13
|
+
detail?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
state: "found" | "not_found";
|
|
16
|
+
key: "grafana" | "github" | "kubernetes" | "docs" | "local_host";
|
|
17
|
+
detail?: string | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type AvailableSource = z.infer<typeof availableSourceSchema>;
|
|
20
|
+
export interface PickupOptions {
|
|
21
|
+
/** The model's own name, as the model reported it. */
|
|
22
|
+
model?: string;
|
|
23
|
+
/** The person agreed to take the run over from another client. */
|
|
24
|
+
takeover?: boolean;
|
|
25
|
+
availableSources?: AvailableSource[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Attaches this process to a run and remembers it as the active run.
|
|
29
|
+
*
|
|
30
|
+
* The client name and version come from the MCP handshake. A Tellagen that
|
|
31
|
+
* does not know the newer pickup fields answers 400; the pickup is then sent
|
|
32
|
+
* once more in the old shape, with the name mapped to codex or claude.
|
|
33
|
+
* Pickup is safe to repeat, so both forms may be retried.
|
|
34
|
+
*/
|
|
35
|
+
export declare function pickUpRun(client: TellagenClient, runId: string, options?: PickupOptions): Promise<unknown>;
|
|
36
|
+
/** Names the guide resources that apply to the run in a pickup answer. */
|
|
37
|
+
export declare function withRunGuides(input: unknown): unknown;
|
|
38
|
+
declare function questionResult(code: string, message: string, extra?: Record<string, unknown>): {
|
|
39
|
+
content: {
|
|
40
|
+
type: "text";
|
|
41
|
+
text: string;
|
|
42
|
+
}[];
|
|
43
|
+
isError: true;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Pickup with the two questions a person must answer: a second session on
|
|
47
|
+
* this computer, and a run another client holds in Tellagen. The person is
|
|
48
|
+
* asked through the client when it can show a question; otherwise the model
|
|
49
|
+
* gets the question as the tool answer.
|
|
50
|
+
*/
|
|
51
|
+
export declare function pickUpWithConsent(client: TellagenClient, runId: string, options: PickupOptions): Promise<{
|
|
52
|
+
data: unknown;
|
|
53
|
+
} | {
|
|
54
|
+
question: ReturnType<typeof questionResult>;
|
|
55
|
+
}>;
|
|
3
56
|
export declare function registerInvestigationTools(server: McpServer, client: TellagenClient): void;
|
|
57
|
+
export {};
|