@hubspot/cli 8.15.0-beta.1 → 8.15.0-beta.3

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 (47) hide show
  1. package/bin/cli.js +6 -1
  2. package/bin/hs.js +1 -0
  3. package/bin/hscms.js +1 -0
  4. package/bin/setupColor.d.ts +2 -0
  5. package/bin/setupColor.js +10 -0
  6. package/lang/en.d.ts +2 -0
  7. package/lang/en.js +2 -0
  8. package/lib/mcp/setup.js +11 -1
  9. package/lib/testUtils.d.ts +1 -0
  10. package/lib/testUtils.js +14 -0
  11. package/lib/theme/cmsDevServerProcess.js +1 -1
  12. package/lib/ui/SpinniesManager.d.ts +1 -0
  13. package/lib/ui/SpinniesManager.js +14 -4
  14. package/lib/ui/index.js +2 -2
  15. package/lib/ui/supportsColor.d.ts +4 -0
  16. package/lib/ui/supportsColor.js +25 -6
  17. package/mcp-server/Tool.d.ts +3 -3
  18. package/mcp-server/Tool.js +3 -1
  19. package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +2 -2
  20. package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
  21. package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +2 -2
  22. package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +2 -2
  23. package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +2 -2
  24. package/mcp-server/tools/cms/HsListTool.d.ts +2 -2
  25. package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +2 -2
  26. package/mcp-server/tools/project/AuthAccountTool.d.ts +2 -2
  27. package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
  28. package/mcp-server/tools/project/CreateTestAccountTool.d.ts +2 -2
  29. package/mcp-server/tools/project/DeployProjectTool.d.ts +2 -2
  30. package/mcp-server/tools/project/DocFetchTool.d.ts +2 -2
  31. package/mcp-server/tools/project/DocsSearchTool.d.ts +2 -2
  32. package/mcp-server/tools/project/FindProjectsTool.d.ts +2 -2
  33. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +2 -2
  34. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +2 -2
  35. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +2 -2
  36. package/mcp-server/tools/project/GetBuildStatusTool.d.ts +2 -2
  37. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +2 -2
  38. package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
  39. package/mcp-server/tools/project/UploadProjectTools.d.ts +2 -2
  40. package/mcp-server/tools/project/UploadProjectTools.js +7 -0
  41. package/mcp-server/tools/project/ValidateProjectTool.d.ts +2 -2
  42. package/mcp-server/types.d.ts +3 -1
  43. package/mcp-server/utils/content.d.ts +2 -2
  44. package/mcp-server/utils/content.js +1 -1
  45. package/mcp-server/utils/json.d.ts +3 -0
  46. package/mcp-server/utils/json.js +29 -0
  47. package/package.json +2 -2
package/bin/cli.js CHANGED
@@ -33,6 +33,7 @@ import mcpCommand from '../commands/mcp.js';
33
33
  import upgradeCommand from '../commands/upgrade.js';
34
34
  import apiCommand from '../commands/api.js';
35
35
  import { uiLogger } from '../lib/ui/logger.js';
36
+ import { lib } from '../lang/en.js';
36
37
  import { initializeSpinniesManager } from '../lib/middleware/spinniesMiddleware.js';
37
38
  import { addCommandSuggestions } from '../lib/commandSuggestion.js';
38
39
  import { pkg } from '../lib/jsonLoader.js';
@@ -80,10 +81,14 @@ const argv = yargs(process.argv.slice(2))
80
81
  describe: 'prevent hyperlinks from displaying in the ui',
81
82
  hidden: true,
82
83
  type: 'boolean',
84
+ })
85
+ .option('color', {
86
+ default: true,
87
+ describe: lib.commonOpts.options.color,
88
+ type: 'boolean',
83
89
  })
84
90
  .option('noColor', {
85
91
  default: false,
86
- describe: 'prevent color from displaying in the ui',
87
92
  hidden: true,
88
93
  type: 'boolean',
89
94
  })
package/bin/hs.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import './setupColor.js';
3
4
  import './silenceErrors.js';
4
5
 
5
6
  import './cli.js';
package/bin/hscms.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import './setupColor.js';
3
4
  import './silenceErrors.js';
4
5
 
5
6
  import './cli.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { hasColorDisableSignal } from '../lib/ui/supportsColor.js';
3
+ // Runs before cli.js so it executes before chalk is imported. chalk reads
4
+ // FORCE_COLOR (but not NO_COLOR / COLOR) once at load and caches its color
5
+ // level, and lang/en.ts bakes chalk styling into strings at import time. So
6
+ // translating a no-color request into FORCE_COLOR=0 here, ahead of those
7
+ // imports, is what makes NO_COLOR / COLOR actually disable color everywhere.
8
+ if (hasColorDisableSignal()) {
9
+ process.env.FORCE_COLOR = '0';
10
+ }
package/lang/en.d.ts CHANGED
@@ -1376,6 +1376,7 @@ export declare const commands: {
1376
1376
  failedToConfigureVsCode: string;
1377
1377
  configuredVsCode: string;
1378
1378
  vsCodeNotFound: string;
1379
+ vsCodeVersionUnsupported: string;
1379
1380
  };
1380
1381
  otherInstructions: {
1381
1382
  header: string;
@@ -3838,6 +3839,7 @@ export declare const lib: {
3838
3839
  jsonOutput: string;
3839
3840
  jsonSchema: string;
3840
3841
  debug: string;
3842
+ color: string;
3841
3843
  };
3842
3844
  };
3843
3845
  configMigrate: {
package/lang/en.js CHANGED
@@ -1392,6 +1392,7 @@ export const commands = {
1392
1392
  failedToConfigureVsCode: 'Failed to configure VSCode',
1393
1393
  configuredVsCode: 'Configured VSCode',
1394
1394
  vsCodeNotFound: "VSCode CLI is not installed (missing 'code' command). Install it and re-run hs mcp setup.",
1395
+ vsCodeVersionUnsupported: 'VSCode 1.99 or later is required for MCP server support. Please update VSCode and try again.',
1395
1396
  },
1396
1397
  otherInstructions: {
1397
1398
  header: 'To connect the HubSpot MCP server to another tool, add the following MCP server configuration.',
@@ -3877,6 +3878,7 @@ export const lib = {
3877
3878
  jsonOutput: 'Format output as JSON',
3878
3879
  jsonSchema: 'Print the JSON output schema and exit',
3879
3880
  debug: 'Set log level to debug',
3881
+ color: 'Enable colored output (use --no-color to disable)',
3880
3882
  },
3881
3883
  },
3882
3884
  configMigrate: {
package/lib/mcp/setup.js CHANGED
@@ -9,6 +9,7 @@ import path from 'path';
9
9
  import os from 'os';
10
10
  import fs from 'fs-extra';
11
11
  import { existsSync } from 'fs';
12
+ import semver from 'semver';
12
13
  const mcpServerName = MCP_SERVER_NAME;
13
14
  const claudeCode = 'claude';
14
15
  const cursor = 'cursor';
@@ -18,6 +19,7 @@ const codex = 'codex';
18
19
  const gemini = 'gemini';
19
20
  const opencode = 'opencode';
20
21
  const OTHER_TOOL = 'other';
22
+ const MINIMUM_VSCODE_VERSION = '1.99.0';
21
23
  const clientLabels = {
22
24
  codex: commands.mcp.setup.codex,
23
25
  claude: commands.mcp.setup.claudeCode,
@@ -204,11 +206,19 @@ function setupMcpConfigFile(config) {
204
206
  }
205
207
  }
206
208
  export async function setupVsCode(mcpCommand = defaultMcpCommand) {
209
+ const commandWithAgent = buildCommandWithAgentString(mcpCommand, vscode);
207
210
  try {
208
211
  SpinniesManager.add('vsCode', {
209
212
  text: commands.mcp.setup.spinners.configuringVsCode,
210
213
  });
211
- const commandWithAgent = buildCommandWithAgentString(mcpCommand, vscode);
214
+ const { stdout } = await execAsync('code --version');
215
+ const version = stdout.trim().split('\n')[0];
216
+ if (!semver.gte(version, MINIMUM_VSCODE_VERSION)) {
217
+ SpinniesManager.fail('vsCode', {
218
+ text: commands.mcp.setup.spinners.vsCodeVersionUnsupported,
219
+ });
220
+ return false;
221
+ }
212
222
  const configObject = {
213
223
  name: mcpServerName,
214
224
  ...commandWithAgent,
@@ -11,4 +11,5 @@ type MockErrorResponse = {
11
11
  };
12
12
  export declare function mockHubSpotHttpResponse<T>(data?: any): HubSpotPromise<T>;
13
13
  export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse): HubSpotHttpError;
14
+ export declare function stubColorEnv(): void;
14
15
  export {};
package/lib/testUtils.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { vi } from 'vitest';
1
2
  import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
2
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  export function mockHubSpotHttpResponse(data) {
@@ -16,3 +17,16 @@ export function mockHubSpotHttpError(message, response) {
16
17
  cause: { isAxiosError: true, response },
17
18
  });
18
19
  }
20
+ // Stubs the color-detection env to a color-capable interactive baseline.
21
+ // Call vi.unstubAllEnvs() in afterEach to restore.
22
+ export function stubColorEnv() {
23
+ [
24
+ 'CI',
25
+ 'NO_COLOR',
26
+ 'COLOR',
27
+ 'FORCE_COLOR',
28
+ 'COLORTERM',
29
+ 'TERM_PROGRAM',
30
+ ].forEach(key => vi.stubEnv(key, undefined));
31
+ vi.stubEnv('TERM', 'xterm-256color');
32
+ }
@@ -10,7 +10,7 @@ import { EXIT_CODES } from '../enums/exitCodes.js';
10
10
  const __filename = fileURLToPath(import.meta.url);
11
11
  const __dirname = path.dirname(__filename);
12
12
  // cms-dev-server version to install to isolated cache
13
- const TARGET_CMS_DEV_SERVER_VERSION = '1.2.44';
13
+ const TARGET_CMS_DEV_SERVER_VERSION = '1.2.70';
14
14
  /**
15
15
  * Ensures cms-dev-server is installed in an isolated cache directory.
16
16
  * This prevents React version conflicts with the CLI.
@@ -13,6 +13,7 @@ declare class SpinniesManager {
13
13
  private currentFrameIndex;
14
14
  private spin;
15
15
  private sigintHandler;
16
+ private rawOutputCache;
16
17
  constructor();
17
18
  init(options?: Partial<SpinnerState>): void;
18
19
  private resetState;
@@ -12,6 +12,7 @@ import chalk from 'chalk';
12
12
  import cliCursor from 'cli-cursor';
13
13
  import { breakText, cleanStream, colorOptions, getLinesLength, prefixOptions, purgeSpinnerOptions, purgeSpinnersOptions, SPINNERS, writeStream, } from './spinniesUtils.js';
14
14
  import { isUnicodeSupported } from '@hubspot/local-dev-lib/isUnicodeSupported';
15
+ import { hasColorDisableSignal } from './supportsColor.js';
15
16
  import { uiLogger } from './logger.js';
16
17
  function safeColor(text, color) {
17
18
  const chalkFn = chalk[color];
@@ -31,6 +32,7 @@ class SpinniesManager {
31
32
  currentFrameIndex = 0;
32
33
  spin;
33
34
  sigintHandler = null;
35
+ rawOutputCache = {};
34
36
  constructor() {
35
37
  this.resetState();
36
38
  }
@@ -46,8 +48,8 @@ class SpinniesManager {
46
48
  this.spin =
47
49
  !this.options.disableSpins &&
48
50
  !process.env.CI &&
49
- process.stderr &&
50
- process.stderr.isTTY;
51
+ !hasColorDisableSignal() &&
52
+ Boolean(process.stderr?.isTTY);
51
53
  if (!this.hasAnySpinners()) {
52
54
  this.resetState();
53
55
  }
@@ -64,6 +66,7 @@ class SpinniesManager {
64
66
  this.stream = process.stderr;
65
67
  this.lineCount = 0;
66
68
  this.currentFrameIndex = 0;
69
+ this.rawOutputCache = {};
67
70
  }
68
71
  setDisableOutput(disableOutput) {
69
72
  this.disableOutput = disableOutput;
@@ -105,6 +108,7 @@ class SpinniesManager {
105
108
  return;
106
109
  }
107
110
  delete this.spinners[name];
111
+ delete this.rawOutputCache[name];
108
112
  // Update the spinner state to clean up the deleted spinner
109
113
  this.updateSpinnerState();
110
114
  }
@@ -230,8 +234,13 @@ class SpinniesManager {
230
234
  this.lineCount = linesLength.length;
231
235
  }
232
236
  setRawStreamOutput() {
233
- Object.values(this.spinners).forEach(i => {
234
- process.stderr.write(`- ${i.text}\n`);
237
+ Object.entries(this.spinners).forEach(([name, spinner]) => {
238
+ const line = `- ${spinner.text ?? ''}\n`;
239
+ if (this.rawOutputCache[name] === line) {
240
+ return;
241
+ }
242
+ this.rawOutputCache[name] = line;
243
+ process.stderr.write(line);
235
244
  });
236
245
  }
237
246
  checkIfActiveSpinners() {
@@ -246,6 +255,7 @@ class SpinniesManager {
246
255
  cliCursor.show();
247
256
  }
248
257
  this.spinners = {};
258
+ this.rawOutputCache = {};
249
259
  }
250
260
  }
251
261
  bindSigint() {
package/lib/ui/index.js CHANGED
@@ -2,7 +2,7 @@ import chalk from 'chalk';
2
2
  import { getConfigAccountIfExists, globalConfigFileExists, } from '@hubspot/local-dev-lib/config';
3
3
  import { uiLogger } from './logger.js';
4
4
  import { supportsHyperlinkModule } from './supportHyperlinks.js';
5
- import { supportsColor } from './supportsColor.js';
5
+ import { isColorEnabled } from './supportsColor.js';
6
6
  import { uiMessages } from './uiMessages.js';
7
7
  import { HUBSPOT_ACCOUNT_TYPE_STRINGS } from '@hubspot/local-dev-lib/constants/config';
8
8
  export const UI_COLORS = {
@@ -16,7 +16,7 @@ export function uiLine() {
16
16
  export function getTerminalUISupport() {
17
17
  return {
18
18
  hyperlinks: supportsHyperlinkModule.stdout,
19
- color: supportsColor.stdout.hasBasic,
19
+ color: isColorEnabled(),
20
20
  };
21
21
  }
22
22
  export function uiLink(linkText, url) {
@@ -4,6 +4,7 @@ interface ColorSupportLevel {
4
4
  has256: boolean;
5
5
  has16m: boolean;
6
6
  }
7
+ export declare function hasColorDisableSignal(): boolean;
7
8
  declare function createSupportsColor(stream: {
8
9
  isTTY?: boolean;
9
10
  } | null, options?: {
@@ -14,4 +15,7 @@ export declare const supportsColor: {
14
15
  stdout: ColorSupportLevel;
15
16
  stderr: ColorSupportLevel;
16
17
  };
18
+ export declare function isColorEnabled(stream?: {
19
+ isTTY?: boolean;
20
+ } | null): boolean;
17
21
  export {};
@@ -19,17 +19,29 @@ function translateLevel(level) {
19
19
  has16m: level >= 3,
20
20
  };
21
21
  }
22
+ function resolveColorPreference() {
23
+ const { NO_COLOR, COLOR, FORCE_COLOR, TERM } = env;
24
+ if (hasFlag('no-color') || hasFlag('noColor'))
25
+ return 'never';
26
+ if (NO_COLOR)
27
+ return 'never';
28
+ if (COLOR === 'false' || COLOR === '0')
29
+ return 'never';
30
+ if (FORCE_COLOR !== undefined) {
31
+ return FORCE_COLOR === '0' || FORCE_COLOR === 'false' ? 'never' : 'always';
32
+ }
33
+ if (TERM === 'dumb')
34
+ return 'never';
35
+ return 'auto';
36
+ }
37
+ export function hasColorDisableSignal() {
38
+ return resolveColorPreference() === 'never';
39
+ }
22
40
  function _supportsColor(haveStream, { streamIsTTY } = {}) {
23
41
  if (haveStream && !streamIsTTY) {
24
42
  return 0;
25
43
  }
26
44
  const min = 0;
27
- if (env.TERM === 'dumb') {
28
- return min;
29
- }
30
- if (hasFlag('noColor')) {
31
- return 0;
32
- }
33
45
  if (process.platform === 'win32') {
34
46
  // Windows 10 build 10586 is the first Windows release that supports 256 colors.
35
47
  // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
@@ -95,3 +107,10 @@ export const supportsColor = {
95
107
  stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
96
108
  stderr: createSupportsColor({ isTTY: tty.isatty(2) }),
97
109
  };
110
+ export function isColorEnabled(stream = process.stdout) {
111
+ const preference = resolveColorPreference();
112
+ if (preference !== 'auto') {
113
+ return preference === 'always';
114
+ }
115
+ return createSupportsColor(stream, { streamIsTTY: stream?.isTTY }).hasBasic;
116
+ }
@@ -2,7 +2,7 @@ import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.
2
2
  import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
3
3
  import { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
4
4
  import { McpLogger } from './utils/logger.js';
5
- import { TextContentResponse } from './types.js';
5
+ import { McpToolResponse } from './types.js';
6
6
  import { CommandResults, Command } from './utils/command.js';
7
7
  export type ToolExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
8
8
  export declare class Tool<InputSchema> {
@@ -11,10 +11,10 @@ export declare class Tool<InputSchema> {
11
11
  protected toolName: string;
12
12
  constructor(mcpServer: McpServer, logger: McpLogger, toolName: string);
13
13
  register(): RegisteredTool;
14
- handler(_input: InputSchema): TextContentResponse | Promise<TextContentResponse>;
14
+ handler(_input: InputSchema): McpToolResponse | Promise<McpToolResponse>;
15
15
  protected runCommand(directory: string, command: Command, extra?: ToolExtra): Promise<CommandResults>;
16
16
  protected getTrackingMeta(_input: InputSchema): {
17
17
  [key: string]: string;
18
18
  } | undefined;
19
- protected wrappedHandler(input: InputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
19
+ protected wrappedHandler(input: InputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
20
20
  }
@@ -69,7 +69,9 @@ export class Tool {
69
69
  error: error instanceof Error ? error.message : String(error),
70
70
  durationMs: Date.now() - startTime,
71
71
  });
72
- return formatTextContents(getErrorMessage(error));
72
+ const errorResponse = await formatTextContents(getErrorMessage(error));
73
+ errorResponse.isError = true;
74
+ return errorResponse;
73
75
  }
74
76
  finally {
75
77
  this.logger.flushLogsToFile(this.toolName);
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -20,7 +20,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
20
20
  export type HsCreateFunctionInputSchema = z.infer<typeof inputSchemaZodObject>;
21
21
  export declare class HsCreateFunctionTool extends Tool<HsCreateFunctionInputSchema> {
22
22
  constructor(mcpServer: McpServer, logger: McpLogger);
23
- handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }: HsCreateFunctionInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
23
+ handler({ dest, functionsFolder, filename, endpointMethod, endpointPath, absoluteCurrentWorkingDirectory, }: HsCreateFunctionInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
24
24
  register(): RegisteredTool;
25
25
  }
26
26
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -16,7 +16,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
16
16
  export type HsCreateModuleInputSchema = z.infer<typeof inputSchemaZodObject>;
17
17
  export declare class HsCreateModuleTool extends Tool<HsCreateModuleInputSchema> {
18
18
  constructor(mcpServer: McpServer, logger: McpLogger);
19
- handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }: HsCreateModuleInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
19
+ handler({ userSuppliedName, dest, moduleLabel, reactType, contentTypes, global, availableForNewContent, absoluteCurrentWorkingDirectory, }: HsCreateModuleInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
20
20
  register(): RegisteredTool;
21
21
  }
22
22
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -21,7 +21,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
21
21
  export type HsCreateTemplateInputSchema = z.infer<typeof inputSchemaZodObject>;
22
22
  export declare class HsCreateTemplateTool extends Tool<HsCreateTemplateInputSchema> {
23
23
  constructor(mcpServer: McpServer, logger: McpLogger);
24
- handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }: HsCreateTemplateInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
24
+ handler({ userSuppliedName, dest, templateType, absoluteCurrentWorkingDirectory, }: HsCreateTemplateInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
25
25
  register(): RegisteredTool;
26
26
  }
27
27
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -14,7 +14,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
14
14
  export type HsFunctionLogsInputSchema = z.infer<typeof inputSchemaZodObject>;
15
15
  export declare class HsFunctionLogsTool extends Tool<HsFunctionLogsInputSchema> {
16
16
  constructor(mcpServer: McpServer, logger: McpLogger);
17
- handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }: HsFunctionLogsInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
17
+ handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }: HsFunctionLogsInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
18
18
  register(): RegisteredTool;
19
19
  }
20
20
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -11,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
11
11
  export type HsListFunctionsInputSchema = z.infer<typeof inputSchemaZodObject>;
12
12
  export declare class HsListFunctionsTool extends Tool<HsListFunctionsInputSchema> {
13
13
  constructor(mcpServer: McpServer, logger: McpLogger);
14
- handler({ account, json, absoluteCurrentWorkingDirectory, }: HsListFunctionsInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
14
+ handler({ account, json, absoluteCurrentWorkingDirectory, }: HsListFunctionsInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
15
15
  register(): RegisteredTool;
16
16
  }
17
17
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -11,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
11
11
  export type HsListInputSchema = z.infer<typeof inputSchemaZodObject>;
12
12
  export declare class HsListTool extends Tool<HsListInputSchema> {
13
13
  constructor(mcpServer: McpServer, logger: McpLogger);
14
- handler({ path, account, absoluteCurrentWorkingDirectory }: HsListInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
14
+ handler({ path, account, absoluteCurrentWorkingDirectory }: HsListInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
15
15
  register(): RegisteredTool;
16
16
  }
17
17
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -33,7 +33,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
33
33
  export type AddFeatureInputSchema = z.infer<typeof inputSchemaZodObject>;
34
34
  export declare class AddFeatureToProjectTool extends Tool<AddFeatureInputSchema> {
35
35
  constructor(mcpServer: McpServer, logger: McpLogger);
36
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }: AddFeatureInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
36
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }: AddFeatureInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
37
37
  register(): RegisteredTool;
38
38
  }
39
39
  export {};
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { McpLogger } from '../../utils/logger.js';
4
4
  import { Tool, ToolExtra } from '../../Tool.js';
5
- import { TextContentResponse } from '../../types.js';
5
+ import { McpToolResponse } from '../../types.js';
6
6
  declare const inputSchemaZodObject: z.ZodObject<{
7
7
  absoluteCurrentWorkingDirectory: z.ZodString;
8
8
  accountId: z.ZodOptional<z.ZodNumber>;
@@ -12,7 +12,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
12
12
  export type AuthAccountInputSchema = z.infer<typeof inputSchemaZodObject>;
13
13
  export declare class AuthAccountTool extends Tool<AuthAccountInputSchema> {
14
14
  constructor(mcpServer: McpServer, logger: McpLogger);
15
- handler({ absoluteCurrentWorkingDirectory, accountId, name, setAsDefault, }: AuthAccountInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
15
+ handler({ absoluteCurrentWorkingDirectory, accountId, name, setAsDefault, }: AuthAccountInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
16
16
  register(): RegisteredTool;
17
17
  }
18
18
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -37,7 +37,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
37
37
  export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
38
38
  export declare class CreateProjectTool extends Tool<CreateProjectInputSchema> {
39
39
  constructor(mcpServer: McpServer, logger: McpLogger);
40
- handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
40
+ handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
41
41
  register(): RegisteredTool;
42
42
  }
43
43
  export {};
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { McpLogger } from '../../utils/logger.js';
4
- import { TextContentResponse } from '../../types.js';
4
+ import { McpToolResponse } from '../../types.js';
5
5
  import { Tool, ToolExtra } from '../../Tool.js';
6
6
  declare const createTestAccountInputSchema: z.ZodObject<{
7
7
  absoluteCurrentWorkingDirectory: z.ZodString;
@@ -47,7 +47,7 @@ declare const createTestAccountInputSchema: z.ZodObject<{
47
47
  export type CreateTestAccountInputSchema = z.infer<typeof createTestAccountInputSchema>;
48
48
  export declare class CreateTestAccountTool extends Tool<CreateTestAccountInputSchema> {
49
49
  constructor(mcpServer: McpServer, logger: McpLogger);
50
- handler({ absoluteCurrentWorkingDirectory, name, description, marketingLevel, opsLevel, serviceLevel, salesLevel, contentLevel, commerceLevel, configPath, }: CreateTestAccountInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
50
+ handler({ absoluteCurrentWorkingDirectory, name, description, marketingLevel, opsLevel, serviceLevel, salesLevel, contentLevel, commerceLevel, configPath, }: CreateTestAccountInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
51
51
  register(): RegisteredTool;
52
52
  }
53
53
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -11,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
11
11
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
12
12
  export declare class DeployProjectTool extends Tool<InputSchemaType> {
13
13
  constructor(mcpServer: McpServer, logger: McpLogger);
14
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildNumber, }: InputSchemaType, extra?: ToolExtra): Promise<TextContentResponse>;
14
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildNumber, }: InputSchemaType, extra?: ToolExtra): Promise<McpToolResponse>;
15
15
  register(): RegisteredTool;
16
16
  }
17
17
  export {};
@@ -1,7 +1,7 @@
1
1
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { McpLogger } from '../../utils/logger.js';
3
3
  import z from 'zod';
4
- import { TextContentResponse } from '../../types.js';
4
+ import { McpToolResponse } from '../../types.js';
5
5
  import { Tool } from '../../Tool.js';
6
6
  declare const inputSchemaZodObject: z.ZodObject<{
7
7
  docUrl: z.ZodString;
@@ -10,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
10
10
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
11
11
  export declare class DocFetchTool extends Tool<InputSchemaType> {
12
12
  constructor(mcpServer: McpServer, logger: McpLogger);
13
- handler({ docUrl, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
13
+ handler({ docUrl, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<McpToolResponse>;
14
14
  register(): RegisteredTool;
15
15
  }
16
16
  export {};
@@ -1,7 +1,7 @@
1
1
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { McpLogger } from '../../utils/logger.js';
3
3
  import z from 'zod';
4
- import { TextContentResponse } from '../../types.js';
4
+ import { McpToolResponse } from '../../types.js';
5
5
  import { Tool } from '../../Tool.js';
6
6
  declare const inputSchemaZodObject: z.ZodObject<{
7
7
  absoluteCurrentWorkingDirectory: z.ZodString;
@@ -23,7 +23,7 @@ export declare class DocsSearchTool extends Tool<InputSchemaType> {
23
23
  protected getTrackingMeta({ docsSearchQuery, }: InputSchemaType): {
24
24
  [key: string]: string;
25
25
  } | undefined;
26
- handler({ docsSearchQuery, docsSearchLimit, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
26
+ handler({ docsSearchQuery, docsSearchLimit, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<McpToolResponse>;
27
27
  register(): RegisteredTool;
28
28
  }
29
29
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -9,7 +9,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
9
9
  export type FindProjectsInputSchema = z.infer<typeof inputSchemaZodObject>;
10
10
  export declare class FindProjectsTool extends Tool<FindProjectsInputSchema> {
11
11
  constructor(mcpServer: McpServer, logger: McpLogger);
12
- handler({ absoluteDirectory, }: FindProjectsInputSchema): Promise<TextContentResponse>;
12
+ handler({ absoluteDirectory, }: FindProjectsInputSchema): Promise<McpToolResponse>;
13
13
  register(): RegisteredTool;
14
14
  }
15
15
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -13,7 +13,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
13
13
  export type GetApiUsagePatternsByAppIdInputSchema = z.infer<typeof inputSchemaZodObject>;
14
14
  export declare class GetApiUsagePatternsByAppIdTool extends Tool<GetApiUsagePatternsByAppIdInputSchema> {
15
15
  constructor(mcpServer: McpServer, logger: McpLogger);
16
- handler({ appId, startDate, endDate, absoluteCurrentWorkingDirectory, absoluteProjectPath, }: GetApiUsagePatternsByAppIdInputSchema): Promise<TextContentResponse>;
16
+ handler({ appId, startDate, endDate, absoluteCurrentWorkingDirectory, absoluteProjectPath, }: GetApiUsagePatternsByAppIdInputSchema): Promise<McpToolResponse>;
17
17
  register(): RegisteredTool;
18
18
  }
19
19
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -10,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
10
10
  export type GetApplicationInfoInputSchema = z.infer<typeof inputSchemaZodObject>;
11
11
  export declare class GetApplicationInfoTool extends Tool<GetApplicationInfoInputSchema> {
12
12
  constructor(mcpServer: McpServer, logger: McpLogger);
13
- handler({ absoluteCurrentWorkingDirectory, absoluteProjectPath, }: GetApplicationInfoInputSchema): Promise<TextContentResponse>;
13
+ handler({ absoluteCurrentWorkingDirectory, absoluteProjectPath, }: GetApplicationInfoInputSchema): Promise<McpToolResponse>;
14
14
  register(): RegisteredTool;
15
15
  }
16
16
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -17,7 +17,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
17
17
  export type GetBuildLogsInputSchema = z.infer<typeof inputSchemaZodObject>;
18
18
  export declare class GetBuildLogsTool extends Tool<GetBuildLogsInputSchema> {
19
19
  constructor(mcpServer: McpServer, logger: McpLogger);
20
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, logLevel, }: GetBuildLogsInputSchema): Promise<TextContentResponse>;
20
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, logLevel, }: GetBuildLogsInputSchema): Promise<McpToolResponse>;
21
21
  register(): RegisteredTool;
22
22
  }
23
23
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -12,7 +12,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
12
12
  export type GetBuildStatusInputSchema = z.infer<typeof inputSchemaZodObject>;
13
13
  export declare class GetBuildStatusTool extends Tool<GetBuildStatusInputSchema> {
14
14
  constructor(mcpServer: McpServer, logger: McpLogger);
15
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, limit, }: GetBuildStatusInputSchema): Promise<TextContentResponse>;
15
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, limit, }: GetBuildStatusInputSchema): Promise<McpToolResponse>;
16
16
  register(): RegisteredTool;
17
17
  }
18
18
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -12,7 +12,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
12
12
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
13
13
  export declare class GetConfigValuesTool extends Tool<InputSchemaType> {
14
14
  constructor(mcpServer: McpServer, logger: McpLogger);
15
- handler({ platformVersion, featureType, absoluteCurrentWorkingDirectory, absoluteProjectPath, }: InputSchemaType): Promise<TextContentResponse>;
15
+ handler({ platformVersion, featureType, absoluteCurrentWorkingDirectory, absoluteProjectPath, }: InputSchemaType): Promise<McpToolResponse>;
16
16
  register(): RegisteredTool;
17
17
  }
18
18
  export {};
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -15,7 +15,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
15
15
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
16
16
  export declare class GuidedWalkthroughTool extends Tool<InputSchemaType> {
17
17
  constructor(mcpServer: McpServer, logger: McpLogger);
18
- handler({ command, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
18
+ handler({ command, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<McpToolResponse>;
19
19
  register(): RegisteredTool;
20
20
  }
21
21
  export {};
@@ -1,7 +1,7 @@
1
1
  import z from 'zod';
2
2
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { McpLogger } from '../../utils/logger.js';
4
- import { TextContentResponse } from '../../types.js';
4
+ import { McpToolResponse } from '../../types.js';
5
5
  import { Tool, ToolExtra } from '../../Tool.js';
6
6
  declare const inputSchemaZodObject: z.ZodObject<{
7
7
  absoluteProjectPath: z.ZodString;
@@ -12,7 +12,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
12
12
  type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
13
13
  export declare class UploadProjectTools extends Tool<InputSchemaType> {
14
14
  constructor(mcpServer: McpServer, logger: McpLogger);
15
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, profile, uploadMessage, }: InputSchemaType, extra?: ToolExtra): Promise<TextContentResponse>;
15
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, profile, uploadMessage, }: InputSchemaType, extra?: ToolExtra): Promise<McpToolResponse>;
16
16
  register(): RegisteredTool;
17
17
  }
18
18
  export {};
@@ -7,6 +7,8 @@ import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constan
7
7
  import { formatTextContent, formatTextContents } from '../../utils/content.js';
8
8
  import { HubSpotCommand } from '../../utils/command.js';
9
9
  import { setupHubSpotConfig } from '../../utils/config.js';
10
+ import { parseCommandJsonOutput } from '../../utils/json.js';
11
+ import { UploadSchema } from '../../../lib/jsonOutput/upload.js';
10
12
  const inputSchema = {
11
13
  absoluteProjectPath,
12
14
  absoluteCurrentWorkingDirectory,
@@ -30,6 +32,7 @@ export class UploadProjectTools extends Tool {
30
32
  setupHubSpotConfig(absoluteCurrentWorkingDirectory);
31
33
  const command = new HubSpotCommand('project upload', [
32
34
  { name: 'force', value: true },
35
+ { name: 'json', value: true },
33
36
  ]);
34
37
  const content = [];
35
38
  if (uploadMessage) {
@@ -60,12 +63,15 @@ export class UploadProjectTools extends Tool {
60
63
  if (content.length > 0) {
61
64
  return {
62
65
  content,
66
+ structuredContent: {},
63
67
  };
64
68
  }
65
69
  const { stdout, stderr } = await this.runCommand(absoluteProjectPath, command, extra);
66
70
  const response = await formatTextContents(stdout, stderr);
67
71
  // Add reminder about cards needing to be added to views
68
72
  response.content.push(formatTextContent('\nIMPORTANT: If this project contains cards, remember that uploading does NOT make them live automatically. Cards must be manually added to a view in HubSpot to become visible to users.'));
73
+ response.structuredContent =
74
+ parseCommandJsonOutput(stdout, UploadSchema, this.logger, toolName) ?? {};
69
75
  return response;
70
76
  }
71
77
  register() {
@@ -73,6 +79,7 @@ export class UploadProjectTools extends Tool {
73
79
  title: 'Upload HubSpot Project',
74
80
  description: 'DO NOT run this tool unless the user specifies they would like to upload the project, it is potentially destructive. Uploads the HubSpot project in current working directory. If the project does not exist, it will be created. MUST be ran from within the project directory. IMPORTANT: Uploading a project does NOT automatically make cards live or visible to users. Cards must be manually added to a view in HubSpot after upload to become visible. If you do not know the project path, use the find-projects tool first to locate HubSpot projects in the workspace.',
75
81
  inputSchema,
82
+ outputSchema: UploadSchema.shape,
76
83
  annotations: {
77
84
  readOnlyHint: false,
78
85
  destructiveHint: true,
@@ -1,4 +1,4 @@
1
- import { TextContentResponse } from '../../types.js';
1
+ import { McpToolResponse } from '../../types.js';
2
2
  import { Tool, ToolExtra } from '../../Tool.js';
3
3
  import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { McpLogger } from '../../utils/logger.js';
@@ -10,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
10
10
  export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
11
11
  export declare class ValidateProjectTool extends Tool<CreateProjectInputSchema> {
12
12
  constructor(mcpServer: McpServer, logger: McpLogger);
13
- handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema, extra?: ToolExtra): Promise<TextContentResponse>;
13
+ handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
14
14
  register(): RegisteredTool;
15
15
  }
16
16
  export {};
@@ -2,6 +2,8 @@ export type TextContent = {
2
2
  type: 'text';
3
3
  text: string;
4
4
  };
5
- export type TextContentResponse = {
5
+ export type McpToolResponse = {
6
6
  content: TextContent[];
7
+ structuredContent?: Record<string, unknown>;
8
+ isError?: boolean;
7
9
  };
@@ -1,3 +1,3 @@
1
- import { TextContent, TextContentResponse } from '../types.js';
2
- export declare function formatTextContents(...outputs: (string | undefined)[]): Promise<TextContentResponse>;
1
+ import { TextContent, McpToolResponse } from '../types.js';
2
+ export declare function formatTextContents(...outputs: (string | undefined)[]): Promise<McpToolResponse>;
3
3
  export declare function formatTextContent(text: string): TextContent;
@@ -2,7 +2,7 @@ import { mcpFeedbackRequest } from './feedbackTracking.js';
2
2
  export async function formatTextContents(...outputs) {
3
3
  const content = [];
4
4
  outputs.forEach(output => {
5
- if (output !== undefined) {
5
+ if (output) {
6
6
  content.push(formatTextContent(output));
7
7
  }
8
8
  });
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ import { McpLogger } from './logger.js';
3
+ export declare function parseCommandJsonOutput<Schema extends z.ZodType>(stdout: string, schema: Schema, logger?: McpLogger, context?: string): z.infer<Schema> | null;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { getErrorMessage } from '../../lib/errorHandlers/index.js';
3
+ // Parses the stdout of a `hs ... --json` command and validates it against the
4
+ // provided schema. Returns the inferred type on success, or null if the output
5
+ // is not valid JSON or fails schema validation. Adopter tools use the returned
6
+ // object as the structuredContent of their response.
7
+ export function parseCommandJsonOutput(stdout, schema, logger, context) {
8
+ const loggerContext = context ?? 'parseCommandJsonOutput';
9
+ let parsed;
10
+ try {
11
+ parsed = JSON.parse(stdout);
12
+ }
13
+ catch (e) {
14
+ logger?.debug(loggerContext, {
15
+ message: 'Failed to parse JSON output',
16
+ error: getErrorMessage(e),
17
+ });
18
+ return null;
19
+ }
20
+ const result = schema.safeParse(parsed);
21
+ if (!result.success) {
22
+ logger?.debug(loggerContext, {
23
+ message: 'JSON output failed schema validation',
24
+ error: z.flattenError(result.error),
25
+ });
26
+ return null;
27
+ }
28
+ return result.data;
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "8.15.0-beta.1",
3
+ "version": "8.15.0-beta.3",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@hubspot/local-dev-lib": "5.11.0",
14
14
  "@hubspot/project-parsing-lib": "0.23.3",
15
- "@hubspot/ui-extensions-dev-server": "2.1.2",
15
+ "@hubspot/ui-extensions-dev-server": "2.2.2",
16
16
  "@inquirer/prompts": "7.1.0",
17
17
  "@modelcontextprotocol/sdk": "1.29.0",
18
18
  "archiver": "7.0.1",