debreu-mcp 2.208.0 → 2.210.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/README.md CHANGED
@@ -92,6 +92,17 @@ When `processing.pending` or `processing.reconciliation_pending` is true, item s
92
92
 
93
93
  There is **no send action**: emails must be sent by the user through Debreu, Gmail, or Outlook. Calendar holds and reply tracking remain owned by the agent runtime. Deploy the backend and this MCP server together to enable the tools; no new database migration is needed for MCP access.
94
94
 
95
+ ### Transactions (feature-gated)
96
+
97
+ M&A precedent deals. These four tools appear only when the authenticated user's `view_transactions` flag is enabled (not on prospecting-only accounts); the backend checks the flag on every request too.
98
+
99
+ | Tool | Description |
100
+ |------|-------------|
101
+ | `query_transactions` | Search the team's precedent deals by company (with role, e.g. bidder, or buy/sell side), type, status, closed-date range and deal value ($M); paginated with `has_more` / `next_offset`. |
102
+ | `get_transaction` | One deal with its parties (company, role, side), multiples (metric, value, basis) and sources. |
103
+ | `create_transactions` | Log up to 100 deals per call. Parties take `company_id` or `company_name` (unclear names return candidates, never a new company); money in $M with a currency per field; returns per-row results and possible duplicates. |
104
+ | `update_transaction` | Patch scalars; `parties` / `multiples` / `sources`, when sent, replace that list. Delete with `delete_record` type `transaction`. |
105
+
95
106
  ### Companies
96
107
 
97
108
  | Tool | Description |
@@ -164,7 +175,7 @@ There is **no send action**: emails must be sent by the user through Debreu, Gma
164
175
 
165
176
  | Tool | Description |
166
177
  |------|-------------|
167
- | `query_comments` | Get comments on a record by data_model (task, company, person, workflow, project, file, prospecting_public_company, prospecting_portfolio_company) and record_id. For companies, also returns comments on other records that @mention the company (with a `mention_context` saying where the comment lives). |
178
+ | `query_comments` | Get comments on a record by data_model (task, company, person, workflow, project, file, prospecting_public_company, prospecting_portfolio_company, deal_memo, calendar, transaction) and record_id. For companies, also returns comments on other records that @mention the company (with a `mention_context` saying where the comment lives). |
168
179
  | `create_comment` | Add a comment to any commentable record (same data_model set as `query_comments`, including prospecting-list rows). |
169
180
  | `update_comment` | Update a comment's content by UUID (author only). |
170
181
 
@@ -298,7 +309,7 @@ There is **no send action**: emails must be sent by the user through Debreu, Gma
298
309
 
299
310
  | Tool | Description |
300
311
  |------|-------------|
301
- | `delete_record` | Delete any record by type and UUID. Supports: company, person, task, metric_schema, project, comment, status_definition, email, calendar, file, port_co_relationship, fund, email_template, biopharma_asset, biopharma_indication, email_campaign, workflow. `workflow` removes a tracker from a project (cascades its views + tracked companies/people; tasks keep their rows with `workflow_id` cleared). For `company`, this is team-scoped — it removes the company from your team only (the company record and other teams' data are preserved); re-adding it restores your team's records. |
312
+ | `delete_record` | Delete any record by type and UUID. Supports: company, person, task, metric_schema, project, comment, status_definition, email, calendar, file, port_co_relationship, fund, email_template, biopharma_asset, biopharma_indication, email_campaign, workflow, transaction. `workflow` removes a tracker from a project (cascades its views + tracked companies/people; tasks keep their rows with `workflow_id` cleared). For `company`, this is team-scoped — it removes the company from your team only (the company record and other teams' data are preserved); re-adding it restores your team's records. |
302
313
 
303
314
  ### Prospecting-only
304
315
 
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { AGENT_TOOLS, AGENT_TOOL_NAMES, agentConflictMessage } from "./agentTools.js";
3
+ import { TRANSACTION_TOOLS, TRANSACTION_TOOL_NAMES } from "./transactionTools.js";
3
4
  import * as fs from "node:fs";
4
5
  import * as path from "node:path";
5
6
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -156,7 +157,7 @@ const OUTREACH_TOOL_NAMES = new Set([
156
157
  /** Write tools whose 4xx detail is shown to the caller, like the outreach tools:
157
158
  * their 400s explain a bad argument ("period_label 'last summer' is not a
158
159
  * period: use YYYY, ...") that the model can fix and retry. */
159
- const CLIENT_ERROR_TOOL_NAMES = new Set(["update_company", "update_project"]);
160
+ const CLIENT_ERROR_TOOL_NAMES = new Set(["update_company", "update_project", ...TRANSACTION_TOOL_NAMES]);
160
161
  /** "HTTP 4xx: <detail>" from an ``HTTP 4xx: <body>`` error, or null. FastAPI
161
162
  * bodies are ``{"detail": "..."}``, or a validation list on 422. */
162
163
  function clientErrorMessage(msg) {
@@ -335,8 +336,9 @@ const COMMENT_DATA_MODELS = [
335
336
  "prospecting_portfolio_company",
336
337
  "deal_memo",
337
338
  "calendar",
339
+ "transaction",
338
340
  ];
339
- const COMMENT_DATA_MODEL_DESCRIPTION = "Record type. 'workflow' is a project tracker; 'deal_memo' is one stage's memo on a deal (it inherits that deal's access); 'calendar' is a meeting (pass its uuid from query_calendars / get_calendar; one thread spans every teammate's copy, open to whoever sees the meeting's full content); the prospecting_* types are prospecting-list rows (not CRM companies).";
341
+ const COMMENT_DATA_MODEL_DESCRIPTION = "Record type. 'workflow' is a project tracker; 'deal_memo' is one stage's memo on a deal (it inherits that deal's access); 'calendar' is a meeting (pass its uuid from query_calendars / get_calendar; one thread spans every teammate's copy, open to whoever sees the meeting's full content); the prospecting_* types are prospecting-list rows (not CRM companies); 'transaction' is a precedent deal (uuid from query_transactions).";
340
342
  /**
341
343
  * Interview rounds a people_list tracker row carries — flat columns on the
342
344
  * backend (see INTERVIEW_ROUNDS in app/schemas/view_to_person.py), so this
@@ -498,6 +500,7 @@ const SEQUENCE_STEP_SCHEMA = {
498
500
  const EMAIL_SEQUENCE_BODY_KEYS = ["name", "folder", "description", "mode", "track_opens", "steps"];
499
501
  const TOOLS = [
500
502
  ...AGENT_TOOLS,
503
+ ...TRANSACTION_TOOLS,
501
504
  // ---- Companies (read) ----
502
505
  {
503
506
  name: "lookup_company",
@@ -3633,7 +3636,7 @@ const TOOLS = [
3633
3636
  description: "Delete a record by type and UUID. Supported types: company, person, task, " +
3634
3637
  "metric_schema, project, comment, status_definition, email, calendar, file, " +
3635
3638
  "port_co_relationship, fund, email_template, biopharma_asset, biopharma_indication, " +
3636
- "email_campaign (an outreach), workflow. " +
3639
+ "email_campaign (an outreach), workflow, transaction. " +
3637
3640
  "Performs soft delete (email/calendar/file use the same cascade behavior as app deletes). " +
3638
3641
  "For workflow, removes a tracker from a project — cascades its views and tracked " +
3639
3642
  "companies/people; tasks keep their rows with workflow_id cleared. Add a tracker with add_tracker. " +
@@ -3674,6 +3677,7 @@ const TOOLS = [
3674
3677
  "biopharma_indication",
3675
3678
  "email_campaign",
3676
3679
  "workflow",
3680
+ "transaction",
3677
3681
  ],
3678
3682
  description: "Type of record to delete.",
3679
3683
  },
@@ -4450,6 +4454,15 @@ const BIOPHARMA_INDICATION_BODY_KEYS = [
4450
4454
  ];
4451
4455
  async function handleTool(name, args) {
4452
4456
  try {
4457
+ if (TRANSACTION_TOOL_NAMES.has(name)) {
4458
+ // Listed only with view_transactions; the backend checks the flag again.
4459
+ const capability = await whoami(keyStore.getStore() || API_KEY);
4460
+ if (capability.body?.view_transactions !== true) {
4461
+ return errorResult("Transactions is not enabled for this account");
4462
+ }
4463
+ const slug = name.replace(/_/g, "-");
4464
+ return textResult(await apiPost(`/api/v1/ext/tools/${slug}`, args));
4465
+ }
4453
4466
  if (AGENT_TOOL_NAMES.has(name)) {
4454
4467
  // Discovery may be cached, but every request also checks the flag in
4455
4468
  // the backend. Missing/failed capability lookup never enables Agents.
@@ -4949,16 +4962,18 @@ const PROSPECTING_ONLY_TOOLS = new Set([
4949
4962
  "get_portfolio_prospect",
4950
4963
  ]);
4951
4964
  function createServer() {
4952
- const server = new Server({ name: "debreu-mcp", version: "2.208.0" }, { capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS });
4965
+ const server = new Server({ name: "debreu-mcp", version: "2.210.0" }, { capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS });
4953
4966
  server.setRequestHandler(ListToolsRequestSchema, async () => {
4954
4967
  // Prospecting-only tenants see a narrowed catalog. whoami returns the
4955
4968
  // allowlist. Preserve the standard catalog on errors, but opt-in Agents
4956
4969
  // always fail closed when the capability lookup is unavailable.
4957
4970
  let allow = null;
4958
4971
  let agentsEnabled = false;
4972
+ let transactionsEnabled = false;
4959
4973
  try {
4960
4974
  const who = (await whoami(keyStore.getStore() || API_KEY)).body;
4961
4975
  agentsEnabled = who?.view_agents === true && who?.prospecting_only !== true;
4976
+ transactionsEnabled = who?.view_transactions === true;
4962
4977
  if (who?.prospecting_only && Array.isArray(who.allowed_tools)) {
4963
4978
  allow = new Set(who.allowed_tools);
4964
4979
  }
@@ -4972,6 +4987,8 @@ function createServer() {
4972
4987
  return false;
4973
4988
  if (AGENT_TOOL_NAMES.has(t.name) && !agentsEnabled)
4974
4989
  return false;
4990
+ if (TRANSACTION_TOOL_NAMES.has(t.name) && !transactionsEnabled)
4991
+ return false;
4975
4992
  // Prospecting-only tenants: exactly the whoami allowlist.
4976
4993
  if (allow)
4977
4994
  return allow.has(t.name);