@opennous/mcp 0.43.0 → 0.44.1
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 +216 -0
- package/package.json +3 -3
- package/src/server.js +128 -18
package/LICENSE
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
204
|
+
Copyright 2026 Nous
|
|
205
|
+
|
|
206
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
207
|
+
you may not use this file except in compliance with the License.
|
|
208
|
+
You may obtain a copy of the License at
|
|
209
|
+
|
|
210
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
211
|
+
|
|
212
|
+
Unless required by applicable law or agreed to in writing, software
|
|
213
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
214
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
|
+
See the License for the specific language governing permissions and
|
|
216
|
+
limitations under the License.
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opennous/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"description": "Nous — the Context Graph for AI Agents.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/NousC/
|
|
8
|
+
"url": "git+https://github.com/NousC/opennous.git",
|
|
9
9
|
"directory": "apps/mcp"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
package/src/server.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* search_notes — semantic search over saved notes & documents
|
|
24
24
|
* get_workspace_status — what's set up in this workspace + a ranked next_steps list (call first)
|
|
25
25
|
* set_workspace_profile— agent-driven onboarding: set the workspace's name, site, type, ICP
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* build_icp_model — build/rebuild the ICP scoring model from the recorded GTM context
|
|
27
|
+
* train_icp_model — build the ICP model from real closed-won/lost deals (contrastive lift)
|
|
28
28
|
* sync_icp — sync the user's EXISTING ICP/positioning files into Nous (file → graph)
|
|
29
29
|
* export_icp_model — get the learned ICP model as a block to write back into their ICP file (graph → file)
|
|
30
30
|
* connect_integration — connect a key-based integration (Apollo, Prospeo, HubSpot, …)
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* list_triggers — list the workspace's event triggers + available events
|
|
35
35
|
* get_routing_preferences — Claude Code routing prefs to default GTM to Nous (write to CLAUDE.md)
|
|
36
36
|
* lead_list_operations — the operations trail of a lead list (imports/enrich/push/replies), filterable
|
|
37
|
-
*
|
|
37
|
+
* get_coverage — pre-spend coverage: exact per-lead check (identifiers) or attribute estimate (title/keyword)
|
|
38
38
|
* enrich_leads — find missing emails for a lead list (two-step: dry-run cost preview, then confirm)
|
|
39
39
|
* verify_leads — validate email deliverability for a lead list (two-step preview, then confirm)
|
|
40
40
|
*/
|
|
@@ -89,9 +89,10 @@ const pct = (c) => `${Math.round((c ?? 0) * 100)}%`;
|
|
|
89
89
|
// Gong/Granola). Returned by get_routing_preferences; the agent writes it into
|
|
90
90
|
// the user's CLAUDE.md (Claude Code) or the user pastes it into claude.ai org
|
|
91
91
|
// preferences. Mirrors the Install page's "short" version.
|
|
92
|
-
const ROUTING_PREFERENCES = `# Nous is this workspace's
|
|
92
|
+
const ROUTING_PREFERENCES = `# Nous is this workspace's Revenue Context Layer
|
|
93
93
|
|
|
94
|
-
Nous is our
|
|
94
|
+
Nous is our Revenue Context Layer for GTM: the pre-computed context every agent reads
|
|
95
|
+
before it acts. Underneath, a context graph resolves every person, conversation, and
|
|
95
96
|
touchpoint across our GTM tool stack into one account record, with each fact's
|
|
96
97
|
confidence and freshness, the full interaction timeline, a 0-100 ICP fit score on
|
|
97
98
|
every account, plus our own ICP, positioning, and pricing. Agents read engineered
|
|
@@ -283,6 +284,19 @@ export function createServer() {
|
|
|
283
284
|
for (const f of rec.facts) lines.push(` [${f.category}] ${f.content}${f.date ? ` (${relAge(f.date)})` : ""}`);
|
|
284
285
|
lines.push("");
|
|
285
286
|
}
|
|
287
|
+
const docs = rec.documents ?? [];
|
|
288
|
+
if (docs.length) {
|
|
289
|
+
// Saved briefs / notes / transcripts kept on the contact — previews only.
|
|
290
|
+
// The agent needs to KNOW these exist so it never reports "no brief on
|
|
291
|
+
// file" when one is saved; the full body is read with search_notes.
|
|
292
|
+
lines.push(`DOCUMENTS (${docs.length} — saved notes & meeting records, read with search_notes):`);
|
|
293
|
+
for (const d of docs) {
|
|
294
|
+
const when = d.date ? ` (${relAge(d.date)})` : "";
|
|
295
|
+
lines.push(` ${d.type.replace(/_/g, " ")}${d.title ? ` · ${d.title}` : ""}${when}`);
|
|
296
|
+
if (d.snippet) lines.push(` ${d.snippet}`);
|
|
297
|
+
}
|
|
298
|
+
lines.push("");
|
|
299
|
+
}
|
|
286
300
|
const claims = Object.values(rec.claims ?? {});
|
|
287
301
|
if (claims.length) {
|
|
288
302
|
lines.push(`ATTRIBUTES (${claims.length}):`);
|
|
@@ -526,6 +540,99 @@ export function createServer() {
|
|
|
526
540
|
}
|
|
527
541
|
);
|
|
528
542
|
|
|
543
|
+
// ===========================================================================
|
|
544
|
+
// TOOL: score — POST /v2/score
|
|
545
|
+
// The thin scoring verb an external list (spreadsheet, Clay column, agent)
|
|
546
|
+
// calls to get Nous's judgment on a row and have it land in the graph. The
|
|
547
|
+
// list stays wherever the user built it; Nous owns the score. Read-mostly:
|
|
548
|
+
// returns the live ICP fit + intent, bootstrap-staking a known-but-unscored
|
|
549
|
+
// row on demand. Cheaper and leaner than get_context on purpose.
|
|
550
|
+
// ===========================================================================
|
|
551
|
+
const scoreOne = (r) => {
|
|
552
|
+
if (!r.resolved) {
|
|
553
|
+
if (r.reason === "ambiguous") {
|
|
554
|
+
const names = (r.candidates || []).map(c => c.name || c.entity_id).join(", ");
|
|
555
|
+
return `ambiguous — several people match${names ? `: ${names}` : ""}. Score by email or LinkedIn URL instead.`;
|
|
556
|
+
}
|
|
557
|
+
return "not in the graph yet — enrich this account first (signals/firmographics), then score.";
|
|
558
|
+
}
|
|
559
|
+
if (!r.scored) return `known, but awaiting enrichment — no scoreable claims yet (${r.entity_id}).`;
|
|
560
|
+
const tier = (r.icp.tier || "").replace(/_/g, " ") || "untiered";
|
|
561
|
+
return `ICP ${r.icp.score}/100 (${tier})${r.icp.fit ? " ✓fit" : ""} · intent ${r.intent.score}/100 ${r.intent.band}` +
|
|
562
|
+
(r.icp.reason ? `\n ${r.icp.reason}` : "");
|
|
563
|
+
};
|
|
564
|
+
server.tool(
|
|
565
|
+
"score",
|
|
566
|
+
"Score a lead against our live ICP model and intent axis, and write the judgment into the graph so " +
|
|
567
|
+
"every other agent reads the same number. This is for scoring a list the user built ELSEWHERE (a " +
|
|
568
|
+
"Google Sheet, a Clay column, a CRM export): the list stays where it is, Nous returns the score. " +
|
|
569
|
+
"Give an email, domain, LinkedIn URL, or entity UUID (or up to 100 at once via `identifiers`). " +
|
|
570
|
+
"Returns ICP fit 0-100 + tier (tier_1/2/3/not_icp, which drives the play) and decaying intent " +
|
|
571
|
+
"0-100 + band. It reads the live score (staking one on demand for a known-but-unscored account); " +
|
|
572
|
+
"the score keeps evolving on its own afterwards. If a row isn't in the graph yet it comes back " +
|
|
573
|
+
"`unknown_identifier` — enrich that account first (signal-scan / a lead-builder), then score.",
|
|
574
|
+
{
|
|
575
|
+
identifier: z.string().optional().describe("One lead — an email, domain, LinkedIn URL, or entity UUID."),
|
|
576
|
+
identifiers: z.array(z.string()).optional().describe("A batch of leads (max 100 per call; loop for a larger list)."),
|
|
577
|
+
intent: z.string().optional().describe("Optional hint about why you're scoring (recorded, does not change the score)."),
|
|
578
|
+
},
|
|
579
|
+
async ({ identifier, identifiers, intent }) => {
|
|
580
|
+
if (Array.isArray(identifiers) && identifiers.length) {
|
|
581
|
+
const r = await post("/v2/score", { identifiers, intent });
|
|
582
|
+
const lines = (r.results || []).map(x => ` ${x.identifier} — ${scoreOne(x)}`);
|
|
583
|
+
const scored = (r.results || []).filter(x => x.scored).length;
|
|
584
|
+
return { content: [{ type: "text", text: `Scored ${scored}/${(r.results || []).length}:\n${lines.join("\n")}` }] };
|
|
585
|
+
}
|
|
586
|
+
const r = await post("/v2/score", { identifier, intent });
|
|
587
|
+
return { content: [{ type: "text", text: `${identifier} — ${scoreOne(r)}` }] };
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
|
|
591
|
+
// ===========================================================================
|
|
592
|
+
// TOOL: attach_list — POST /v2/lead-lists/attach
|
|
593
|
+
// Batch-score a list the user built ELSEWHERE (a Google Sheet, a CRM export, a
|
|
594
|
+
// Clay table). One call: create/reuse a Nous list, ingest the rows (entities
|
|
595
|
+
// resolved+deduped), score every row into the graph. The list stays where it
|
|
596
|
+
// is; Nous keeps the roster so the scores stay fresh and agents can read them.
|
|
597
|
+
// ===========================================================================
|
|
598
|
+
server.tool(
|
|
599
|
+
"attach_list",
|
|
600
|
+
"Score a whole list the user built somewhere ELSE — a Google Sheet, a CRM export, a Clay table — " +
|
|
601
|
+
"in one call. Give the rows and Nous creates a lead list, resolves each row to a person/company " +
|
|
602
|
+
"(deduped against everything already in the graph), and scores every one against the live ICP model " +
|
|
603
|
+
"+ intent axis so the judgment lands in the graph for other agents. The spreadsheet stays the user's; " +
|
|
604
|
+
"Nous just owns the score and keeps it fresh. Each row needs an email OR a LinkedIn URL. Rows we don't " +
|
|
605
|
+
"know enough about yet come back `awaiting_enrichment` — run signal-scan / a lead-builder on them, then " +
|
|
606
|
+
"re-attach. Pass `lead_list_id` instead of `name` to add to an existing list. Max 200 rows per call — " +
|
|
607
|
+
"loop for a bigger sheet.",
|
|
608
|
+
{
|
|
609
|
+
name: z.string().optional().describe("Name for the new list (e.g. 'Q3 sheet — inbound'). Omit only when passing lead_list_id."),
|
|
610
|
+
lead_list_id: z.string().optional().describe("Add to an existing list instead of creating one."),
|
|
611
|
+
source: z.string().optional().describe("Where the list came from, e.g. 'google_sheet', 'crm_export' (default 'external')."),
|
|
612
|
+
rows: z.array(z.object({
|
|
613
|
+
email: z.string().optional(),
|
|
614
|
+
linkedin_url: z.string().optional(),
|
|
615
|
+
domain: z.string().optional(),
|
|
616
|
+
company: z.string().optional(),
|
|
617
|
+
name: z.string().optional(),
|
|
618
|
+
}).passthrough()).describe("The list rows. Each needs an email or a linkedin_url."),
|
|
619
|
+
import_duplicates: z.boolean().optional().describe("Force-insert rows already in this list (default false — deduped)."),
|
|
620
|
+
},
|
|
621
|
+
async ({ name, lead_list_id, source, rows, import_duplicates }) => {
|
|
622
|
+
const r = await post("/v2/lead-lists/attach", { name, lead_list_id, source, rows, import_duplicates });
|
|
623
|
+
const head = `Attached ${rows.length} rows to list ${r.lead_list_id} — ` +
|
|
624
|
+
`${r.inserted} new, ${r.duplicate_skipped} already in list. ` +
|
|
625
|
+
`Scored ${r.scored}; ${r.awaiting_enrichment} awaiting enrichment; ${r.unresolved} unresolved.`;
|
|
626
|
+
const top = (r.results || [])
|
|
627
|
+
.filter(x => x.scored)
|
|
628
|
+
.sort((a, b) => (b.icp?.score ?? 0) - (a.icp?.score ?? 0))
|
|
629
|
+
.slice(0, 10)
|
|
630
|
+
.map(x => ` ${x.identifier} — ICP ${x.icp.score} (${(x.icp.tier || "").replace(/_/g, " ")}) · intent ${x.intent.score} ${x.intent.band}`);
|
|
631
|
+
const tail = r.awaiting_enrichment ? `\n\n${r.awaiting_enrichment} rows need enrichment before they can score — run signal-scan or a lead-builder on the list, then re-attach.` : "";
|
|
632
|
+
return { content: [{ type: "text", text: `${head}${top.length ? `\n\nTop scored:\n${top.join("\n")}` : ""}${tail}` }] };
|
|
633
|
+
}
|
|
634
|
+
);
|
|
635
|
+
|
|
529
636
|
// ===========================================================================
|
|
530
637
|
// TOOL: attention — GET /v2/attention
|
|
531
638
|
// What to look at: accounts gone quiet, key facts decayed.
|
|
@@ -757,7 +864,10 @@ export function createServer() {
|
|
|
757
864
|
const lines = [`Documents matching "${question}":`, ""];
|
|
758
865
|
for (const d of r.documents) {
|
|
759
866
|
const when = d.date ? ` [${relAge(d.date)}]` : "";
|
|
760
|
-
|
|
867
|
+
// similarity is null for recency-matched hits (a note too fresh to be
|
|
868
|
+
// embedded yet) — label those "recent" instead of a bogus 0%.
|
|
869
|
+
const match = d.similarity == null ? "recent" : pct(d.similarity);
|
|
870
|
+
lines.push(` ${d.type.replace(/_/g, " ")}${d.title ? ` · ${d.title}` : ""} (${match})${when}`);
|
|
761
871
|
if (d.snippet) lines.push(` ${d.snippet}`);
|
|
762
872
|
lines.push(` (entity_id: ${d.entity_id})`);
|
|
763
873
|
}
|
|
@@ -905,14 +1015,14 @@ export function createServer() {
|
|
|
905
1015
|
);
|
|
906
1016
|
|
|
907
1017
|
// ===========================================================================
|
|
908
|
-
// TOOL:
|
|
1018
|
+
// TOOL: build_icp_model — POST /v2/workspace/scoring-model
|
|
909
1019
|
// The second half of building the GTM playbook. The agent syncs the GTM context
|
|
910
1020
|
// from the user's files with sync_icp, then calls this to turn it into a weighted
|
|
911
1021
|
// ICP scoring model. After this, accounts get scored for fit and
|
|
912
1022
|
// get_workspace_status shows the playbook as done.
|
|
913
1023
|
// ===========================================================================
|
|
914
1024
|
server.tool(
|
|
915
|
-
"
|
|
1025
|
+
"build_icp_model",
|
|
916
1026
|
"Build (or rebuild) the user's ICP scoring model from their synced GTM context. This is " +
|
|
917
1027
|
"the second half of setting up the GTM playbook: first sync the user's ICP/positioning/pricing " +
|
|
918
1028
|
"files with sync_icp, then call this to translate that context into a weighted set of scoring " +
|
|
@@ -921,7 +1031,7 @@ export function createServer() {
|
|
|
921
1031
|
"pass force:true (use that when the context files have changed and the model should be rebuilt). If " +
|
|
922
1032
|
"it reports no GTM context yet, sync the user's context files with sync_icp first, then call this again. " +
|
|
923
1033
|
"STRONGER than this tool: if the user can name a few closed-WON and closed-LOST customer domains, " +
|
|
924
|
-
"call
|
|
1034
|
+
"call train_icp_model instead (or as well) — it trains the model on real outcomes via " +
|
|
925
1035
|
"contrastive lift, which beats a model inferred from a description.",
|
|
926
1036
|
{
|
|
927
1037
|
force: z.boolean().optional()
|
|
@@ -945,7 +1055,7 @@ export function createServer() {
|
|
|
945
1055
|
}
|
|
946
1056
|
if (msg.includes("model_exists")) {
|
|
947
1057
|
return { content: [{ type: "text", text:
|
|
948
|
-
"A scoring model already exists. Call
|
|
1058
|
+
"A scoring model already exists. Call build_icp_model again with force:true to rebuild it from the current GTM context." }] };
|
|
949
1059
|
}
|
|
950
1060
|
throw e;
|
|
951
1061
|
}
|
|
@@ -953,11 +1063,11 @@ export function createServer() {
|
|
|
953
1063
|
);
|
|
954
1064
|
|
|
955
1065
|
// ===========================================================================
|
|
956
|
-
// TOOL:
|
|
1066
|
+
// TOOL: train_icp_model — POST /v2/workspace/closed-deals
|
|
957
1067
|
// Build the ICP model from REAL outcomes via contrastive lift (won vs lost).
|
|
958
1068
|
// ===========================================================================
|
|
959
1069
|
server.tool(
|
|
960
|
-
"
|
|
1070
|
+
"train_icp_model",
|
|
961
1071
|
"Build (or sharpen) the ICP scoring model from the user's REAL closed deals. Pass closed-WON " +
|
|
962
1072
|
"customer domains and closed-LOST domains; Nous enriches each, links the contacts you already " +
|
|
963
1073
|
"have there, and runs contrastive lift (what's true of winners but not losers) to discover the " +
|
|
@@ -1049,7 +1159,7 @@ export function createServer() {
|
|
|
1049
1159
|
const sig = r.signals ?? [];
|
|
1050
1160
|
if (r.model_status === "created" && sig.length) {
|
|
1051
1161
|
lines.push("", `Built the ICP scoring model — ${sig.length} signal${sig.length === 1 ? "" : "s"}.`);
|
|
1052
|
-
lines.push("Next: if the user can name a few closed-won + closed-lost domains, call
|
|
1162
|
+
lines.push("Next: if the user can name a few closed-won + closed-lost domains, call train_icp_model to sharpen it on real outcomes, then call export_icp_model to write the learned model back into their ICP file.");
|
|
1053
1163
|
} else if (r.model_status === "no_icp_memory") {
|
|
1054
1164
|
lines.push("", "Synced, but there wasn't enough ICP content to build a scoring model — make sure the ICP section has real content.");
|
|
1055
1165
|
} else {
|
|
@@ -1082,7 +1192,7 @@ export function createServer() {
|
|
|
1082
1192
|
"calibration gap) as a ready-to-write markdown block, and write it back into the user's own ICP " +
|
|
1083
1193
|
"file. This is the payoff of the symbiosis: their file keeps the words, Nous keeps the model, and " +
|
|
1084
1194
|
"this writes the model under their words. CLAUDE CODE flow: call this after sync_icp or after " +
|
|
1085
|
-
"
|
|
1195
|
+
"train_icp_model, then with your file tools open `target_path`, and if the file already has a " +
|
|
1086
1196
|
"block between '<!-- nous:icp start -->' and '<!-- nous:icp end -->' REPLACE that whole block with " +
|
|
1087
1197
|
"the returned `block`; if not, append the returned `block` (e.g. replacing a '## [To refine]' " +
|
|
1088
1198
|
"placeholder). Never edit inside the markers by hand — this tool regenerates them. Everything " +
|
|
@@ -1093,11 +1203,11 @@ export function createServer() {
|
|
|
1093
1203
|
if (!r.has_model) {
|
|
1094
1204
|
return { content: [{ type: "text", text:
|
|
1095
1205
|
"No ICP scoring model yet. Sync the user's ICP file with sync_icp first (or build one with " +
|
|
1096
|
-
"
|
|
1206
|
+
"build_icp_model / train_icp_model), then call this to write it back." }] };
|
|
1097
1207
|
}
|
|
1098
1208
|
const note = r.has_outcomes
|
|
1099
1209
|
? "This model is trained on real closed deals (lift + calibration shown)."
|
|
1100
|
-
: "This model is seeded from the ICP only — add closed deals with
|
|
1210
|
+
: "This model is seeded from the ICP only — add closed deals with train_icp_model to sharpen it.";
|
|
1101
1211
|
return { content: [{ type: "text", text:
|
|
1102
1212
|
`Write the block below into ${r.target_path} with your file editor — replace any existing block ` +
|
|
1103
1213
|
`between the nous:icp markers, or append it if there's none (create the file/section if absent). ` +
|
|
@@ -1316,14 +1426,14 @@ export function createServer() {
|
|
|
1316
1426
|
);
|
|
1317
1427
|
|
|
1318
1428
|
// ===========================================================================
|
|
1319
|
-
// TOOL:
|
|
1429
|
+
// TOOL: get_coverage — POST /v2/dedup (exact) | GET /v2/people/coverage (estimate)
|
|
1320
1430
|
// "What do I already have?" before spending on a list elsewhere. One tool, two
|
|
1321
1431
|
// modes: pass identifiers for an EXACT per-lead net-new/re-enrich/reuse check
|
|
1322
1432
|
// (the pre-spend gate), or a title/keyword for a rough attribute ESTIMATE.
|
|
1323
1433
|
// (Replaces the former check_leads + lead_coverage tools.)
|
|
1324
1434
|
// ===========================================================================
|
|
1325
1435
|
server.tool(
|
|
1326
|
-
"
|
|
1436
|
+
"get_coverage",
|
|
1327
1437
|
"(Nous Cloud only) Check what you ALREADY have before spending on a list elsewhere (Apollo, Sales Navigator, Clay). " +
|
|
1328
1438
|
"Two modes:\n" +
|
|
1329
1439
|
" • EXACT — pass candidate identifiers (emails / linkedin_urls / domains, free in any tool's " +
|