@koda-sl/baker-cli 0.484.0 → 0.486.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.
Files changed (103) hide show
  1. package/README.md +13 -1
  2. package/dist/{brand-LAIIXZBL.js → brand-TRPJFCRL.js} +2 -2
  3. package/dist/{canvas-EAC3236V.js → canvas-ZKBXEUYK.js} +11 -11
  4. package/dist/{chunk-FY5RZBOY.js → chunk-67S6LADS.js} +2 -2
  5. package/dist/{chunk-Q4WWS3UQ.js → chunk-7SHNGCJ2.js} +2 -2
  6. package/dist/{chunk-AXDKLXCG.js → chunk-CTJPTSD4.js} +2 -2
  7. package/dist/{chunk-5O77KEKO.js → chunk-DFQHO3SL.js} +3 -3
  8. package/dist/{chunk-ADSNY4KZ.js → chunk-DVA4DOBH.js} +2 -2
  9. package/dist/{chunk-Z5SOZUUB.js → chunk-F4WLKHUS.js} +2 -2
  10. package/dist/{chunk-MGIOV72F.js → chunk-GIECLBJ3.js} +3 -3
  11. package/dist/{chunk-27DJRM3F.js → chunk-GPY2JEXL.js} +2 -2
  12. package/dist/{chunk-CS5JF52J.js → chunk-HDTR5DNA.js} +2 -2
  13. package/dist/{chunk-VNNCYWNN.js → chunk-HKQH6H2P.js} +3 -3
  14. package/dist/{chunk-CM6FCSWN.js → chunk-LCMIAWUZ.js} +3 -1
  15. package/dist/chunk-LCMIAWUZ.js.map +1 -0
  16. package/dist/{chunk-IX2QLW6G.js → chunk-OEYVPXQZ.js} +28 -4
  17. package/dist/chunk-OEYVPXQZ.js.map +1 -0
  18. package/dist/{chunk-K2JTERIO.js → chunk-RSYOUKIQ.js} +2 -2
  19. package/dist/{chunk-3PXC2OXT.js → chunk-X3PM773M.js} +2 -2
  20. package/dist/{chunk-EFL6RNH3.js → chunk-YXVJA37O.js} +5 -5
  21. package/dist/cli.js +8 -8
  22. package/dist/{create-B3QMYSIX.js → create-RBZJ27B2.js} +3 -3
  23. package/dist/{creatives-NK5HOXSF.js → creatives-K2BKGN6J.js} +5 -5
  24. package/dist/{critique-N5OL42C6.js → critique-2UMC3GJP.js} +14 -7
  25. package/dist/critique-2UMC3GJP.js.map +1 -0
  26. package/dist/{critique-EDMP5P5R.js → critique-GTUDKADX.js} +4 -4
  27. package/dist/{delete-S4VKH7IS.js → delete-EJG3MRM2.js} +3 -3
  28. package/dist/{feedback-OCN3XNKF.js → feedback-7JVO62CE.js} +7 -7
  29. package/dist/{feedback-record-Z66AXZ57.js → feedback-record-YEJZKVFC.js} +7 -7
  30. package/dist/{fonts-I434ILTG.js → fonts-DIVC6DP2.js} +4 -4
  31. package/dist/{get-MGDY5JYZ.js → get-ZI6RB6K5.js} +3 -3
  32. package/dist/{landing-EJGYTI5W.js → landing-6OJYUEWP.js} +2 -2
  33. package/dist/{list-SZH6TH74.js → list-VY4UTTRG.js} +3 -3
  34. package/dist/{make-ZYEFMAR6.js → make-2XZBKFJC.js} +8 -8
  35. package/dist/{mcp-T6SAG4XB.js → mcp-MTFBVKLX.js} +279 -28
  36. package/dist/mcp-MTFBVKLX.js.map +1 -0
  37. package/dist/{rerun-VL3FSINT.js → rerun-VCZBNGDW.js} +8 -8
  38. package/dist/{run-HCJKCEOL.js → run-IKGW7UPB.js} +3 -3
  39. package/dist/{run-NTUJERPZ.js → run-WOOBUVP3.js} +8 -8
  40. package/dist/{scaffold-ad-LZSSM5HS.js → scaffold-ad-PJ47R3IF.js} +6 -6
  41. package/dist/{scaffold-static-ad-F4HEJJ5N.js → scaffold-static-ad-PZBZV6SQ.js} +11 -11
  42. package/dist/{scaffold-video-7KSBESQ6.js → scaffold-video-GU4C7HCK.js} +5 -5
  43. package/dist/{scheduled-agents-MFLMG34I.js → scheduled-agents-MUCDCONT.js} +10 -10
  44. package/dist/{schema-EFR7NGJG.js → schema-YT2DBX6T.js} +2 -2
  45. package/dist/{select-POYNXE2L.js → select-JM2MFVNP.js} +6 -6
  46. package/dist/{set-prompt-USTAJUV6.js → set-prompt-JP3MASVF.js} +4 -4
  47. package/dist/{stale-6HL4ELJW.js → stale-VCZRIG25.js} +5 -5
  48. package/dist/{sync-definition-YGQU4BFK.js → sync-definition-Z7TY43IA.js} +5 -5
  49. package/dist/{targets-NI7TR4GV.js → targets-SF4AOFZ3.js} +3 -3
  50. package/dist/{translate-ACGKNKQP.js → translate-ZONETQ2W.js} +7 -7
  51. package/dist/{triggers-WYFM7PAH.js → triggers-PJ3UJAHM.js} +3 -3
  52. package/dist/{unstage-MCM6EZWK.js → unstage-NPQ5JQ6S.js} +3 -3
  53. package/dist/{update-GUIP6G3N.js → update-77YN5JEJ.js} +3 -3
  54. package/dist/{validate-SXDUQ5KO.js → validate-UTNTXLOL.js} +6 -6
  55. package/package.json +1 -1
  56. package/dist/chunk-CM6FCSWN.js.map +0 -1
  57. package/dist/chunk-IX2QLW6G.js.map +0 -1
  58. package/dist/critique-N5OL42C6.js.map +0 -1
  59. package/dist/mcp-T6SAG4XB.js.map +0 -1
  60. /package/dist/{brand-LAIIXZBL.js.map → brand-TRPJFCRL.js.map} +0 -0
  61. /package/dist/{canvas-EAC3236V.js.map → canvas-ZKBXEUYK.js.map} +0 -0
  62. /package/dist/{chunk-FY5RZBOY.js.map → chunk-67S6LADS.js.map} +0 -0
  63. /package/dist/{chunk-Q4WWS3UQ.js.map → chunk-7SHNGCJ2.js.map} +0 -0
  64. /package/dist/{chunk-AXDKLXCG.js.map → chunk-CTJPTSD4.js.map} +0 -0
  65. /package/dist/{chunk-5O77KEKO.js.map → chunk-DFQHO3SL.js.map} +0 -0
  66. /package/dist/{chunk-ADSNY4KZ.js.map → chunk-DVA4DOBH.js.map} +0 -0
  67. /package/dist/{chunk-Z5SOZUUB.js.map → chunk-F4WLKHUS.js.map} +0 -0
  68. /package/dist/{chunk-MGIOV72F.js.map → chunk-GIECLBJ3.js.map} +0 -0
  69. /package/dist/{chunk-27DJRM3F.js.map → chunk-GPY2JEXL.js.map} +0 -0
  70. /package/dist/{chunk-CS5JF52J.js.map → chunk-HDTR5DNA.js.map} +0 -0
  71. /package/dist/{chunk-VNNCYWNN.js.map → chunk-HKQH6H2P.js.map} +0 -0
  72. /package/dist/{chunk-K2JTERIO.js.map → chunk-RSYOUKIQ.js.map} +0 -0
  73. /package/dist/{chunk-3PXC2OXT.js.map → chunk-X3PM773M.js.map} +0 -0
  74. /package/dist/{chunk-EFL6RNH3.js.map → chunk-YXVJA37O.js.map} +0 -0
  75. /package/dist/{create-B3QMYSIX.js.map → create-RBZJ27B2.js.map} +0 -0
  76. /package/dist/{creatives-NK5HOXSF.js.map → creatives-K2BKGN6J.js.map} +0 -0
  77. /package/dist/{critique-EDMP5P5R.js.map → critique-GTUDKADX.js.map} +0 -0
  78. /package/dist/{delete-S4VKH7IS.js.map → delete-EJG3MRM2.js.map} +0 -0
  79. /package/dist/{feedback-OCN3XNKF.js.map → feedback-7JVO62CE.js.map} +0 -0
  80. /package/dist/{feedback-record-Z66AXZ57.js.map → feedback-record-YEJZKVFC.js.map} +0 -0
  81. /package/dist/{fonts-I434ILTG.js.map → fonts-DIVC6DP2.js.map} +0 -0
  82. /package/dist/{get-MGDY5JYZ.js.map → get-ZI6RB6K5.js.map} +0 -0
  83. /package/dist/{landing-EJGYTI5W.js.map → landing-6OJYUEWP.js.map} +0 -0
  84. /package/dist/{list-SZH6TH74.js.map → list-VY4UTTRG.js.map} +0 -0
  85. /package/dist/{make-ZYEFMAR6.js.map → make-2XZBKFJC.js.map} +0 -0
  86. /package/dist/{rerun-VL3FSINT.js.map → rerun-VCZBNGDW.js.map} +0 -0
  87. /package/dist/{run-HCJKCEOL.js.map → run-IKGW7UPB.js.map} +0 -0
  88. /package/dist/{run-NTUJERPZ.js.map → run-WOOBUVP3.js.map} +0 -0
  89. /package/dist/{scaffold-ad-LZSSM5HS.js.map → scaffold-ad-PJ47R3IF.js.map} +0 -0
  90. /package/dist/{scaffold-static-ad-F4HEJJ5N.js.map → scaffold-static-ad-PZBZV6SQ.js.map} +0 -0
  91. /package/dist/{scaffold-video-7KSBESQ6.js.map → scaffold-video-GU4C7HCK.js.map} +0 -0
  92. /package/dist/{scheduled-agents-MFLMG34I.js.map → scheduled-agents-MUCDCONT.js.map} +0 -0
  93. /package/dist/{schema-EFR7NGJG.js.map → schema-YT2DBX6T.js.map} +0 -0
  94. /package/dist/{select-POYNXE2L.js.map → select-JM2MFVNP.js.map} +0 -0
  95. /package/dist/{set-prompt-USTAJUV6.js.map → set-prompt-JP3MASVF.js.map} +0 -0
  96. /package/dist/{stale-6HL4ELJW.js.map → stale-VCZRIG25.js.map} +0 -0
  97. /package/dist/{sync-definition-YGQU4BFK.js.map → sync-definition-Z7TY43IA.js.map} +0 -0
  98. /package/dist/{targets-NI7TR4GV.js.map → targets-SF4AOFZ3.js.map} +0 -0
  99. /package/dist/{translate-ACGKNKQP.js.map → translate-ZONETQ2W.js.map} +0 -0
  100. /package/dist/{triggers-WYFM7PAH.js.map → triggers-PJ3UJAHM.js.map} +0 -0
  101. /package/dist/{unstage-MCM6EZWK.js.map → unstage-NPQ5JQ6S.js.map} +0 -0
  102. /package/dist/{update-GUIP6G3N.js.map → update-77YN5JEJ.js.map} +0 -0
  103. /package/dist/{validate-SXDUQ5KO.js.map → validate-UTNTXLOL.js.map} +0 -0
@@ -5,9 +5,9 @@ import {
5
5
  fontsCommand,
6
6
  fontsFetchCommand,
7
7
  lookupGoogleCss
8
- } from "./chunk-CS5JF52J.js";
9
- import "./chunk-K2JTERIO.js";
10
- import "./chunk-IX2QLW6G.js";
8
+ } from "./chunk-HDTR5DNA.js";
9
+ import "./chunk-RSYOUKIQ.js";
10
+ import "./chunk-OEYVPXQZ.js";
11
11
  import "./chunk-JYALBYN7.js";
12
12
  import "./chunk-5WMTPYKT.js";
13
13
  import "./chunk-23H4ZJRP.js";
@@ -33,4 +33,4 @@ export {
33
33
  fontsFetchCommand,
34
34
  lookupGoogleCss
35
35
  };
36
- //# sourceMappingURL=fonts-I434ILTG.js.map
36
+ //# sourceMappingURL=fonts-DIVC6DP2.js.map
@@ -3,8 +3,8 @@ import {
3
3
  failValidation,
4
4
  isTempScheduledAgentId,
5
5
  validateScheduledAgentRef
6
- } from "./chunk-ADSNY4KZ.js";
7
- import "./chunk-CM6FCSWN.js";
6
+ } from "./chunk-DVA4DOBH.js";
7
+ import "./chunk-LCMIAWUZ.js";
8
8
  import {
9
9
  CHAT_READ_ARG
10
10
  } from "./chunk-PFBQERWX.js";
@@ -76,4 +76,4 @@ var getCommand = defineCommand({
76
76
  export {
77
77
  getCommand
78
78
  };
79
- //# sourceMappingURL=get-MGDY5JYZ.js.map
79
+ //# sourceMappingURL=get-ZI6RB6K5.js.map
@@ -17,7 +17,7 @@ Subcommands:
17
17
  },
18
18
  subCommands: {
19
19
  inspiration: () => import("./inspiration-XQYHBJY2.js").then((m) => m.inspirationCommand),
20
- critique: () => import("./critique-N5OL42C6.js").then((m) => m.critiqueCommand),
20
+ critique: () => import("./critique-2UMC3GJP.js").then((m) => m.critiqueCommand),
21
21
  variant: () => import("./variant-5TRRSYBB.js").then((m) => m.variantCommand),
22
22
  export: () => import("./export-OLDI32HM.js").then((m) => m.exportCommand)
23
23
  }
@@ -25,4 +25,4 @@ Subcommands:
25
25
  export {
26
26
  landingCommand
27
27
  };
28
- //# sourceMappingURL=landing-EJGYTI5W.js.map
28
+ //# sourceMappingURL=landing-6OJYUEWP.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  failApi
3
- } from "./chunk-ADSNY4KZ.js";
4
- import "./chunk-CM6FCSWN.js";
3
+ } from "./chunk-DVA4DOBH.js";
4
+ import "./chunk-LCMIAWUZ.js";
5
5
  import {
6
6
  CHAT_READ_ARG
7
7
  } from "./chunk-PFBQERWX.js";
@@ -61,4 +61,4 @@ var listCommand = defineCommand({
61
61
  export {
62
62
  listCommand
63
63
  };
64
- //# sourceMappingURL=list-SZH6TH74.js.map
64
+ //# sourceMappingURL=list-VY4UTTRG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  scaffoldDelivery
3
- } from "./chunk-Z5SOZUUB.js";
3
+ } from "./chunk-F4WLKHUS.js";
4
4
  import {
5
5
  buildSearchBody
6
6
  } from "./chunk-MXWOYFI2.js";
@@ -17,13 +17,13 @@ import {
17
17
  import {
18
18
  makeSeriesAd,
19
19
  seriesMadeEnvelope
20
- } from "./chunk-27DJRM3F.js";
20
+ } from "./chunk-GPY2JEXL.js";
21
21
  import "./chunk-XZ4YMCZK.js";
22
22
  import {
23
23
  runBaker
24
- } from "./chunk-MGIOV72F.js";
24
+ } from "./chunk-GIECLBJ3.js";
25
25
  import "./chunk-UWXDNVS5.js";
26
- import "./chunk-Q4WWS3UQ.js";
26
+ import "./chunk-7SHNGCJ2.js";
27
27
  import {
28
28
  parseDefinitionDelivery,
29
29
  parseDefinitionSourceFields,
@@ -35,7 +35,7 @@ import {
35
35
  reroutedOnSpec,
36
36
  thinkingOutline,
37
37
  withThinking
38
- } from "./chunk-AXDKLXCG.js";
38
+ } from "./chunk-CTJPTSD4.js";
39
39
  import "./chunk-ABXTGAG7.js";
40
40
  import {
41
41
  audienceQuery,
@@ -89,8 +89,8 @@ import {
89
89
  checkIdeas,
90
90
  sourcesClaims
91
91
  } from "./chunk-G2LGMWNG.js";
92
- import "./chunk-K2JTERIO.js";
93
- import "./chunk-IX2QLW6G.js";
92
+ import "./chunk-RSYOUKIQ.js";
93
+ import "./chunk-OEYVPXQZ.js";
94
94
  import "./chunk-JYALBYN7.js";
95
95
  import "./chunk-BITS62MF.js";
96
96
  import "./chunk-FNA277HP.js";
@@ -1350,4 +1350,4 @@ export {
1350
1350
  startsFromIdea,
1351
1351
  unbuiltReference
1352
1352
  };
1353
- //# sourceMappingURL=make-ZYEFMAR6.js.map
1353
+ //# sourceMappingURL=make-2XZBKFJC.js.map
@@ -47,7 +47,7 @@ var mcpCatalogResponseSchema = z.object({
47
47
  });
48
48
 
49
49
  // src/commands/mcp/index.ts
50
- import { defineCommand } from "citty";
50
+ import { defineCommand as defineCommand2 } from "citty";
51
51
 
52
52
  // src/commands/mcp/catalog.ts
53
53
  var PREFER_VENDOR_HINT = 'The vendor\'s own MCP server comes before any app here. If you have not yet, WebSearch "<vendor> MCP server" and WebFetch its official docs for the remote https address and how it signs in, then ask for it with request_connection `{ server: { name, url, auth, keyHeader } }`. Only when the vendor has none, ask for an app from this catalog with request_connection `{ app: "<slug>", reason }` \u2014 the user connects it in the chat and its tools load right after, in this same turn.';
@@ -71,6 +71,250 @@ function catalogHints(apps, { platforms = [] } = {}) {
71
71
  return hints;
72
72
  }
73
73
 
74
+ // ../api/src/mcp-tools.ts
75
+ import { z as z2 } from "zod";
76
+ var MCP_TOOLS_DEFAULT_LIMIT = 10;
77
+ var MCP_TOOL_DESCRIPTION_MAX = 200;
78
+ var mcpToolSlugSchema = z2.string().trim().min(1, "Provide --tool").max(120).regex(/^[A-Za-z0-9_]+$/, "A tool is named like GMAIL_FETCH_EMAILS \u2014 find one with `baker mcp tools --search`").transform((slug) => slug.toUpperCase());
79
+ var mcpAppSlugSchema = z2.string().trim().min(1).max(60).regex(/^[a-z0-9_-]+$/i, "Name the app as `baker mcp connected` lists it, e.g. gmail").transform((slug) => slug.toLowerCase());
80
+ var mcpToolsRequestSchema = z2.object({
81
+ search: z2.string().trim().min(1).max(200).optional(),
82
+ app: mcpAppSlugSchema.optional(),
83
+ limit: z2.coerce.number().int().min(1).max(50).default(MCP_TOOLS_DEFAULT_LIMIT)
84
+ }).refine((request) => request.search !== void 0 || request.app !== void 0, {
85
+ message: "Provide --search, --app, or both"
86
+ });
87
+ var mcpToolSummarySchema = z2.object({
88
+ tool: z2.string(),
89
+ app: z2.string(),
90
+ name: z2.string(),
91
+ description: z2.string().max(MCP_TOOL_DESCRIPTION_MAX),
92
+ /** Only read-only tools run through `baker mcp execute`. */
93
+ readOnly: z2.boolean()
94
+ });
95
+ var mcpToolsResponseSchema = z2.object({
96
+ tools: z2.array(mcpToolSummarySchema),
97
+ /** The connected apps the search ran over. */
98
+ apps: z2.array(z2.string())
99
+ });
100
+ var mcpToolRequestSchema = z2.object({
101
+ tool: mcpToolSlugSchema,
102
+ full: z2.boolean().default(false)
103
+ });
104
+ var mcpToolInputSchema = z2.object({
105
+ name: z2.string(),
106
+ type: z2.string(),
107
+ required: z2.boolean(),
108
+ description: z2.string().optional(),
109
+ enum: z2.array(z2.unknown()).optional(),
110
+ default: z2.unknown().optional()
111
+ });
112
+ var mcpToolResponseSchema = z2.object({
113
+ tool: z2.string(),
114
+ app: z2.string(),
115
+ name: z2.string(),
116
+ description: z2.string(),
117
+ readOnly: z2.boolean(),
118
+ inputs: z2.array(mcpToolInputSchema),
119
+ /** The raw JSON schemas, with `--full` only. */
120
+ inputSchema: z2.unknown().optional(),
121
+ outputSchema: z2.unknown().optional()
122
+ });
123
+ var mcpExecuteRequestSchema = z2.object({
124
+ tool: mcpToolSlugSchema,
125
+ arguments: z2.record(z2.string(), z2.unknown()).default({}),
126
+ actingUserId: z2.string().optional()
127
+ });
128
+ var mcpExecuteResponseSchema = z2.object({
129
+ tool: z2.string(),
130
+ app: z2.string(),
131
+ /** Whose connection answered: `company` is the one a published Report reads. */
132
+ scope: z2.enum(["user", "user_org", "company", "org"]),
133
+ account: z2.string().nullable(),
134
+ /** What the tool returned, as the app returned it. */
135
+ data: z2.unknown()
136
+ });
137
+
138
+ // src/commands/mcp/execute.ts
139
+ import { defineCommand } from "citty";
140
+ var EXECUTE_TIMEOUT_MS = 12e4;
141
+ function fail(err) {
142
+ if (err instanceof ApiError) {
143
+ writeJson({ ok: false, error: { code: err.code, message: err.message } });
144
+ process.exit(1);
145
+ }
146
+ writeJson({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
147
+ process.exit(1);
148
+ }
149
+ function invalid(message) {
150
+ return fail(new ApiError("VALIDATION_ERROR", message));
151
+ }
152
+ function actingUserId() {
153
+ return getEnv().BAKER_ACTING_USER_ID;
154
+ }
155
+ function executeHints(ran) {
156
+ const hints = [];
157
+ if (ran.scope !== "company") {
158
+ hints.push(
159
+ `This answer came from a ${ran.scope === "org" ? "connection shared by the organization" : "connection of the person sending this message"}. A published report reads only apps connected for the whole company, so ${ran.tool} will answer "not connected" there: ask the user to connect ${ran.app} for the whole company before building a report on it.`
160
+ );
161
+ }
162
+ hints.push(
163
+ `In a report endpoint: runReportBaker(event, ["mcp", "execute", "--tool", "${ran.tool}", "--data", JSON.stringify(args)]) \u2014 return only the fields the page shows.`
164
+ );
165
+ return hints;
166
+ }
167
+ var toolsArgs = {
168
+ search: {
169
+ type: "string",
170
+ description: 'What the tool should do, e.g. "fetch emails", "read sheet rows"',
171
+ required: false
172
+ },
173
+ app: {
174
+ type: "string",
175
+ description: "Only this connected app, as `baker mcp connected` lists it (gmail)",
176
+ required: false
177
+ },
178
+ limit: { type: "string", description: "Max tools to return, 1-50 (default 10)", required: false }
179
+ };
180
+ registerSchema({
181
+ command: "mcp.tools",
182
+ description: 'Find a connected app\'s tools to run with `baker mcp execute`. Searches the apps this chat reaches (or --app). Each tool: tool (slug), app, name, description, readOnly (only read-only tools run). Example: baker mcp tools --app googlesheets --search "read rows"',
183
+ args: toolsArgs
184
+ });
185
+ var toolsCommand = defineCommand({
186
+ meta: {
187
+ name: "tools",
188
+ description: `Find a connected app's tools to run from the command line with \`baker mcp execute\`.
189
+
190
+ Start here:
191
+ baker mcp tools --search "fetch unread emails" # across every connected app
192
+ baker mcp tools --app googlesheets --search "read rows"
193
+ baker mcp tools --app hubspot --limit 20 # an app's tools, no search
194
+
195
+ Each tool: tool (the slug execute takes), app, name, description, readOnly.
196
+ Only readOnly tools run through execute; a tool that changes things is the chat's own mcp__composio_* tool.`
197
+ },
198
+ args: toolsArgs,
199
+ run: async ({ args }) => {
200
+ const parsed = mcpToolsRequestSchema.safeParse({ search: args.search, app: args.app, limit: args.limit });
201
+ if (!parsed.success) {
202
+ invalid(parsed.error.issues[0]?.message ?? "Invalid arguments");
203
+ }
204
+ try {
205
+ const user = actingUserId();
206
+ const data = await apiGet("/api/mcp/tools", {
207
+ ...parsed.data.search ? { search: parsed.data.search } : {},
208
+ ...parsed.data.app ? { app: parsed.data.app } : {},
209
+ limit: String(parsed.data.limit),
210
+ ...user ? { actingUserId: user } : {}
211
+ });
212
+ const hints = data.apps.length === 0 ? [
213
+ "No app is connected here. Check `baker mcp connected`; connect one with request_connection, from the chat."
214
+ ] : [
215
+ "Run one with `baker mcp execute --tool <TOOL> --get-schema` first to see its inputs, then `--data '<json>'`.",
216
+ ...data.tools.some((tool) => !tool.readOnly) ? [
217
+ "readOnly: false tools cannot run through execute \u2014 they change things; use the chat's mcp__composio_* tool."
218
+ ] : []
219
+ ];
220
+ writeJson({ ok: true, data, hints });
221
+ } catch (err) {
222
+ fail(err);
223
+ }
224
+ }
225
+ });
226
+ var executeArgs = {
227
+ tool: { type: "string", description: "Tool slug from `baker mcp tools`, e.g. GMAIL_FETCH_EMAILS", required: true },
228
+ data: {
229
+ type: "string",
230
+ description: `The tool's arguments as a JSON object, e.g. '{"max_results":10}'`,
231
+ required: false
232
+ },
233
+ "get-schema": { type: "boolean", description: "Show the tool's inputs instead of running it", required: false },
234
+ full: {
235
+ type: "boolean",
236
+ description: "With --get-schema: the raw input and output JSON schemas too",
237
+ required: false
238
+ }
239
+ };
240
+ registerSchema({
241
+ command: "mcp.execute",
242
+ description: `Run one read-only tool of a connected app and print what it returned as JSON \u2014 for a report's data endpoint, a script, or keeping the answer. \`--get-schema\` shows its inputs first. A published report reaches only apps connected for the whole company. Example: baker mcp execute --tool GOOGLESHEETS_BATCH_GET --data '{"spreadsheet_id":"\u2026","ranges":["A1:D50"]}'`,
243
+ args: executeArgs
244
+ });
245
+ function parseData(raw) {
246
+ if (raw === void 0 || raw === "") {
247
+ return {};
248
+ }
249
+ let value;
250
+ try {
251
+ value = JSON.parse(String(raw));
252
+ } catch {
253
+ invalid(`--data must be a JSON object, e.g. '{"max_results":10}' (keys and strings in double quotes).`);
254
+ }
255
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
256
+ invalid(`--data must be a JSON object, e.g. '{"max_results":10}'.`);
257
+ }
258
+ return value;
259
+ }
260
+ var executeCommand = defineCommand({
261
+ meta: {
262
+ name: "execute",
263
+ description: `Run one read-only tool of a connected app; prints what it returned as JSON.
264
+
265
+ The same tools as the chat's mcp__composio_* servers, answered on stdout so a report's data endpoint,
266
+ a script or a file can keep it. Find the tool with \`baker mcp tools\`, read its inputs, then run it:
267
+ baker mcp execute --tool GOOGLESHEETS_BATCH_GET --get-schema
268
+ baker mcp execute --tool GOOGLESHEETS_BATCH_GET --data '{"spreadsheet_id":"1AbC\u2026","ranges":["Sheet1!A1:D50"]}'
269
+ baker mcp execute --tool GMAIL_FETCH_EMAILS --data '{"query":"is:unread newer_than:7d","max_results":20}' > /tmp/inbox.json
270
+
271
+ Reads only: a tool that changes things (send, create, update) is refused \u2014 use the chat's own tool for it.
272
+ A published report runs as nobody, so it reaches only apps connected for the whole company; a
273
+ person's own connection answers in their chat and nowhere else.`
274
+ },
275
+ args: executeArgs,
276
+ run: async ({ args }) => {
277
+ if (args["get-schema"]) {
278
+ const parsed2 = mcpToolRequestSchema.safeParse({ tool: args.tool, full: args.full === true });
279
+ if (!parsed2.success) {
280
+ invalid(parsed2.error.issues[0]?.message ?? "Invalid arguments");
281
+ }
282
+ try {
283
+ const data = await apiGet("/api/mcp/tool", {
284
+ tool: parsed2.data.tool,
285
+ ...parsed2.data.full ? { full: "true" } : {}
286
+ });
287
+ writeJson({
288
+ ok: true,
289
+ data,
290
+ hints: data.readOnly ? [`Run it: baker mcp execute --tool ${data.tool} --data '<json object of the inputs above>'`] : [
291
+ `${data.tool} changes things, so execute refuses it. In a chat, use the app's own mcp__composio_* tool.`
292
+ ]
293
+ });
294
+ } catch (err) {
295
+ fail(err);
296
+ }
297
+ return;
298
+ }
299
+ const parsed = mcpExecuteRequestSchema.safeParse({
300
+ tool: args.tool,
301
+ arguments: parseData(args.data),
302
+ actingUserId: actingUserId()
303
+ });
304
+ if (!parsed.success) {
305
+ invalid(parsed.error.issues[0]?.message ?? "Invalid arguments");
306
+ }
307
+ try {
308
+ const data = await apiPost("/api/mcp/execute", parsed.data, {
309
+ timeoutMs: EXECUTE_TIMEOUT_MS
310
+ });
311
+ writeJson({ ok: true, data, hints: executeHints(data) });
312
+ } catch (err) {
313
+ fail(err);
314
+ }
315
+ }
316
+ });
317
+
74
318
  // src/commands/mcp/platforms.ts
75
319
  function readsKey(label) {
76
320
  const [first = "", ...rest] = label.split(" ");
@@ -93,7 +337,7 @@ function parseScope(raw) {
93
337
  }
94
338
  return scope;
95
339
  }
96
- function actingUserId() {
340
+ function actingUserId2() {
97
341
  return getEnv().BAKER_ACTING_USER_ID;
98
342
  }
99
343
  function customEntry(server) {
@@ -124,7 +368,7 @@ function parseHeaders(raw, rawArgs) {
124
368
  }
125
369
  return Object.keys(headers).length > 0 ? headers : void 0;
126
370
  }
127
- function fail(err) {
371
+ function fail2(err) {
128
372
  if (err instanceof ApiError) {
129
373
  writeJson({ ok: false, error: { code: err.code, message: err.message } });
130
374
  process.exit(1);
@@ -138,7 +382,7 @@ registerSchema({
138
382
  description: "List everything this chat can reach: managed integrations (Attio, Slack, Gmail, Google Sheets, \u2026), custom MCP servers, and the platforms the company signed in to (HubSpot, Google Ads, GA4, Search Console, Tag Manager) which you read through their own `baker` commands. Start here when the user mentions an external tool or platform.",
139
383
  args: {}
140
384
  });
141
- var connectedCommand = defineCommand({
385
+ var connectedCommand = defineCommand2({
142
386
  meta: {
143
387
  name: "connected",
144
388
  description: `Everything this chat can reach \u2014 managed integrations, custom MCP servers, and connected platforms.
@@ -150,7 +394,7 @@ A tool or platform the user names that is NOT listed anywhere here is simply not
150
394
  },
151
395
  run: async () => {
152
396
  try {
153
- const user = actingUserId();
397
+ const user = actingUserId2();
154
398
  const data = await apiGet("/api/mcp/connected", user ? { actingUserId: user } : void 0);
155
399
  const managed = data.managed.map((c) => ({
156
400
  toolkit: c.toolkitSlug,
@@ -185,7 +429,7 @@ A tool or platform the user names that is NOT listed anywhere here is simply not
185
429
  hints
186
430
  });
187
431
  } catch (err) {
188
- fail(err);
432
+ fail2(err);
189
433
  }
190
434
  }
191
435
  });
@@ -198,7 +442,7 @@ registerSchema({
198
442
  description: "Search the managed apps you can ask the user to connect when a vendor has no MCP server of its own. Each app says how the user connects it (sign-in | key) and whether this chat already reaches it. Example: baker mcp catalog --search notion",
199
443
  args: catalogArgs
200
444
  });
201
- var catalogCommand = defineCommand({
445
+ var catalogCommand = defineCommand2({
202
446
  meta: {
203
447
  name: "catalog",
204
448
  description: `Managed apps you can ask the user to connect when a vendor has no MCP server of its own.
@@ -221,7 +465,7 @@ Prefer the vendor's own MCP server when it publishes one; a catalog app is the f
221
465
  process.exit(1);
222
466
  }
223
467
  try {
224
- const user = actingUserId();
468
+ const user = actingUserId2();
225
469
  const data = await apiGet("/api/mcp/catalog", {
226
470
  search: parsed.data.search,
227
471
  limit: String(parsed.data.limit),
@@ -236,7 +480,7 @@ Prefer the vendor's own MCP server when it publishes one; a catalog app is the f
236
480
  hints: catalogHints(data.apps, { platforms: data.platforms ?? [] })
237
481
  });
238
482
  } catch (err) {
239
- fail(err);
483
+ fail2(err);
240
484
  }
241
485
  }
242
486
  });
@@ -245,11 +489,11 @@ registerSchema({
245
489
  description: "List the custom MCP servers this company's chats see (org + company + your own user scope).",
246
490
  args: {}
247
491
  });
248
- var listCommand = defineCommand({
492
+ var listCommand = defineCommand2({
249
493
  meta: { name: "list", description: "List custom MCP servers visible to this company's chats." },
250
494
  run: async () => {
251
495
  try {
252
- const user = actingUserId();
496
+ const user = actingUserId2();
253
497
  const data = await apiGet(
254
498
  "/api/mcp/custom",
255
499
  user ? { actingUserId: user } : void 0
@@ -264,7 +508,7 @@ var listCommand = defineCommand({
264
508
  } : {}
265
509
  });
266
510
  } catch (err) {
267
- fail(err);
511
+ fail2(err);
268
512
  }
269
513
  }
270
514
  });
@@ -282,7 +526,7 @@ registerSchema({
282
526
  header: { type: "string", description: 'Auth header "Key: Value" (repeatable)', required: false }
283
527
  }
284
528
  });
285
- var addCommand = defineCommand({
529
+ var addCommand = defineCommand2({
286
530
  meta: {
287
531
  name: "add",
288
532
  description: `Register a custom MCP server. Tools appear as mcp__<name>__* on the NEXT message.
@@ -309,7 +553,7 @@ Examples:
309
553
  run: async ({ args, rawArgs }) => {
310
554
  try {
311
555
  const scope = parseScope(args.scope);
312
- const user = actingUserId();
556
+ const user = actingUserId2();
313
557
  const headers = parseHeaders(args.header, rawArgs);
314
558
  const data = await apiPost("/api/mcp/custom", {
315
559
  name: args.name,
@@ -327,7 +571,7 @@ Examples:
327
571
  ]
328
572
  });
329
573
  } catch (err) {
330
- fail(err);
574
+ fail2(err);
331
575
  }
332
576
  }
333
577
  });
@@ -336,7 +580,7 @@ registerSchema({
336
580
  description: "Remove a company custom MCP server by name.",
337
581
  args: { name: { type: "string", description: "Server name to remove", required: true } }
338
582
  });
339
- var removeCommand = defineCommand({
583
+ var removeCommand = defineCommand2({
340
584
  meta: {
341
585
  name: "remove",
342
586
  description: `Remove a company custom MCP server by name.
@@ -347,14 +591,14 @@ Example:
347
591
  args: { name: { type: "string", description: "Server name to remove", required: true } },
348
592
  run: async ({ args }) => {
349
593
  try {
350
- const user = actingUserId();
594
+ const user = actingUserId2();
351
595
  const data = await apiPost("/api/mcp/custom/remove", {
352
596
  name: args.name,
353
597
  ...user ? { actingUserId: user } : {}
354
598
  });
355
599
  writeJson({ ok: true, data });
356
600
  } catch (err) {
357
- fail(err);
601
+ fail2(err);
358
602
  }
359
603
  }
360
604
  });
@@ -366,7 +610,7 @@ registerSchema({
366
610
  description: "Check a custom MCP server now (the dashboard's 'Check now') and store the result. Use after the user fixed its address or sign-in, or when its tools failed this turn.",
367
611
  args: serverNameArgs
368
612
  });
369
- var verifyCommand = defineCommand({
613
+ var verifyCommand = defineCommand2({
370
614
  meta: {
371
615
  name: "verify",
372
616
  description: `Check a custom MCP server now and store the result.
@@ -376,9 +620,9 @@ Example:
376
620
  },
377
621
  args: serverNameArgs,
378
622
  run: async ({ args }) => {
379
- const parsed = customMcpServerNameRequestSchema.safeParse({ name: args.name, actingUserId: actingUserId() });
623
+ const parsed = customMcpServerNameRequestSchema.safeParse({ name: args.name, actingUserId: actingUserId2() });
380
624
  if (!parsed.success) {
381
- fail(new ApiError("VALIDATION_ERROR", parsed.error.issues[0]?.message ?? "Invalid arguments"));
625
+ fail2(new ApiError("VALIDATION_ERROR", parsed.error.issues[0]?.message ?? "Invalid arguments"));
382
626
  }
383
627
  try {
384
628
  const data = await apiPost("/api/mcp/custom/verify", parsed.data);
@@ -390,7 +634,7 @@ Example:
390
634
  ]
391
635
  });
392
636
  } catch (err) {
393
- fail(err);
637
+ fail2(err);
394
638
  }
395
639
  }
396
640
  });
@@ -399,7 +643,7 @@ registerSchema({
399
643
  description: "Switch a custom MCP server off so its tools stop loading; its address and sign-in are kept. Turning it back on is done by a person in the dashboard, never by the agent.",
400
644
  args: serverNameArgs
401
645
  });
402
- var disableCommand = defineCommand({
646
+ var disableCommand = defineCommand2({
403
647
  meta: {
404
648
  name: "disable",
405
649
  description: `Switch a custom MCP server off (its tools stop loading). Only a person can turn it back on, in the dashboard.
@@ -409,9 +653,9 @@ Example:
409
653
  },
410
654
  args: serverNameArgs,
411
655
  run: async ({ args }) => {
412
- const parsed = customMcpServerNameRequestSchema.safeParse({ name: args.name, actingUserId: actingUserId() });
656
+ const parsed = customMcpServerNameRequestSchema.safeParse({ name: args.name, actingUserId: actingUserId2() });
413
657
  if (!parsed.success) {
414
- fail(new ApiError("VALIDATION_ERROR", parsed.error.issues[0]?.message ?? "Invalid arguments"));
658
+ fail2(new ApiError("VALIDATION_ERROR", parsed.error.issues[0]?.message ?? "Invalid arguments"));
415
659
  }
416
660
  try {
417
661
  const data = await apiPost("/api/mcp/custom/disable", parsed.data);
@@ -423,11 +667,11 @@ Example:
423
667
  ]
424
668
  });
425
669
  } catch (err) {
426
- fail(err);
670
+ fail2(err);
427
671
  }
428
672
  }
429
673
  });
430
- var mcpCommand = defineCommand({
674
+ var mcpCommand = defineCommand2({
431
675
  meta: {
432
676
  name: "mcp",
433
677
  description: `Third-party tools for this company \u2014 see what's connected, register custom HTTPS MCP endpoints.
@@ -439,6 +683,11 @@ Start here:
439
683
  baker mcp connected # everything this chat can reach: managed integrations, custom servers, connected platforms
440
684
  baker mcp catalog --search notion # managed apps you can connect when a vendor has no MCP server of its own
441
685
 
686
+ Run a connected app's read-only tool from the command line (JSON on stdout \u2014 for reports and scripts):
687
+ baker mcp tools --app googlesheets --search "read rows"
688
+ baker mcp execute --tool GOOGLESHEETS_BATCH_GET --get-schema
689
+ baker mcp execute --tool GOOGLESHEETS_BATCH_GET --data '{"spreadsheet_id":"\u2026","ranges":["A1:D50"]}'
690
+
442
691
  Examples:
443
692
  baker mcp add --name weather --url https://mcp.example.com/mcp
444
693
  baker mcp add --name acme --url https://acme.dev/mcp --header "Authorization: Bearer sk-\u2026"
@@ -450,6 +699,8 @@ Full guide: __tooling__/docs/tools/baker/mcp.md`
450
699
  subCommands: {
451
700
  connected: connectedCommand,
452
701
  catalog: catalogCommand,
702
+ tools: toolsCommand,
703
+ execute: executeCommand,
453
704
  list: listCommand,
454
705
  add: addCommand,
455
706
  remove: removeCommand,
@@ -460,4 +711,4 @@ Full guide: __tooling__/docs/tools/baker/mcp.md`
460
711
  export {
461
712
  mcpCommand
462
713
  };
463
- //# sourceMappingURL=mcp-T6SAG4XB.js.map
714
+ //# sourceMappingURL=mcp-MTFBVKLX.js.map