@hubspot/cli 8.4.0 → 8.5.0-beta.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/api/migrate.js +3 -3
- package/bin/cli.js +3 -0
- package/commands/app/migrate.js +4 -4
- package/commands/getStarted.js +2 -2
- package/commands/project/add.js +3 -3
- package/commands/project/create.js +10 -7
- package/commands/project/delete.js +2 -2
- package/commands/project/deploy.js +4 -3
- package/commands/project/dev/index.js +5 -4
- package/commands/project/info.js +2 -2
- package/commands/project/migrate.js +5 -5
- package/commands/project/profile/add.js +2 -2
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/upload.js +3 -3
- package/commands/project/validate.js +2 -2
- package/commands/project/watch.js +2 -2
- package/commands/project.js +6 -3
- package/commands/testAccount/create.js +4 -4
- package/lang/en.d.ts +11 -0
- package/lang/en.js +16 -5
- package/lib/app/migrate.js +7 -0
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +0 -1
- package/lib/doctor/Doctor.js +2 -2
- package/lib/getStartedV2Actions.js +2 -2
- package/lib/hasFeature.js +1 -2
- package/lib/middleware/autoUpdateMiddleware.js +6 -3
- package/lib/projects/ProjectLogsManager.js +6 -3
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v2.js +3 -4
- package/lib/projects/delete.js +2 -2
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/upload.js +22 -3
- package/lib/projects/workspaces.d.ts +42 -0
- package/lib/projects/workspaces.js +350 -0
- package/lib/prompts/projectsLogsPrompt.js +3 -0
- package/lib/theme/cmsDevServerProcess.js +1 -1
- package/mcp-server/Tool.d.ts +15 -0
- package/mcp-server/Tool.js +53 -0
- package/mcp-server/server.js +5 -3
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +8 -6
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -6
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +8 -6
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +8 -6
- package/mcp-server/tools/cms/HsListTool.d.ts +4 -2
- package/mcp-server/tools/cms/HsListTool.js +8 -6
- package/mcp-server/tools/index.d.ts +3 -2
- package/mcp-server/tools/index.js +22 -22
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +8 -6
- package/mcp-server/tools/project/CreateProjectTool.d.ts +6 -4
- package/mcp-server/tools/project/CreateProjectTool.js +9 -7
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +20 -8
- package/mcp-server/tools/project/DeployProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/DeployProjectTool.js +4 -6
- package/mcp-server/tools/project/DocFetchTool.d.ts +4 -2
- package/mcp-server/tools/project/DocFetchTool.js +8 -6
- package/mcp-server/tools/project/DocsSearchTool.d.ts +9 -3
- package/mcp-server/tools/project/DocsSearchTool.js +32 -9
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +8 -6
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +4 -2
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildLogsTool.js +8 -6
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +4 -2
- package/mcp-server/tools/project/GetBuildStatusTool.js +8 -6
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -2
- package/mcp-server/tools/project/GetConfigValuesTool.js +12 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +4 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -6
- package/mcp-server/tools/project/UploadProjectTools.d.ts +4 -2
- package/mcp-server/tools/project/UploadProjectTools.js +9 -7
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +4 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +8 -6
- package/mcp-server/tools/project/constants.d.ts +2 -2
- package/mcp-server/types.d.ts +0 -7
- package/mcp-server/types.js +1 -13
- package/mcp-server/utils/logger.d.ts +10 -0
- package/mcp-server/utils/logger.js +29 -0
- package/mcp-server/utils/toolUsageTracking.js +0 -2
- package/package.json +10 -10
- package/lib/projects/platformVersion.d.ts +0 -9
- package/lib/projects/platformVersion.js +0 -39
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
const inputSchema = {
|
|
@@ -30,12 +29,11 @@ const inputSchema = {
|
|
|
30
29
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
31
30
|
const toolName = 'get-cms-serverless-function-logs';
|
|
32
31
|
export class HsFunctionLogsTool extends Tool {
|
|
33
|
-
constructor(mcpServer) {
|
|
34
|
-
super(mcpServer);
|
|
32
|
+
constructor(mcpServer, logger) {
|
|
33
|
+
super(mcpServer, logger, toolName);
|
|
35
34
|
}
|
|
36
35
|
async handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }) {
|
|
37
36
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
38
|
-
await trackToolUsage(toolName);
|
|
39
37
|
// Ensure endpoint doesn't start with '/'
|
|
40
38
|
const normalizedEndpoint = endpoint.startsWith('/')
|
|
41
39
|
? endpoint.slice(1)
|
|
@@ -58,6 +56,10 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
58
56
|
return formatTextContents(stdout, stderr);
|
|
59
57
|
}
|
|
60
58
|
catch (error) {
|
|
59
|
+
this.logger.debug(toolName, {
|
|
60
|
+
message: 'Handler caught error',
|
|
61
|
+
error: error instanceof Error ? error.message : String(error),
|
|
62
|
+
});
|
|
61
63
|
return formatTextContents(`Error executing hs logs command: ${getErrorMessage(error)}`);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -70,6 +72,6 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
70
72
|
readOnlyHint: true,
|
|
71
73
|
openWorldHint: true,
|
|
72
74
|
},
|
|
73
|
-
}, this.
|
|
75
|
+
}, input => this.wrappedHandler(input));
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -8,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
8
10
|
}, z.core.$strip>;
|
|
9
11
|
export type HsListFunctionsInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
10
12
|
export declare class HsListFunctionsTool extends Tool<HsListFunctionsInputSchema> {
|
|
11
|
-
constructor(mcpServer: McpServer);
|
|
13
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
12
14
|
handler({ account, json, absoluteCurrentWorkingDirectory, }: HsListFunctionsInputSchema): Promise<TextContentResponse>;
|
|
13
15
|
register(): RegisteredTool;
|
|
14
16
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
const inputSchema = {
|
|
@@ -22,12 +21,11 @@ const inputSchema = {
|
|
|
22
21
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
23
22
|
const toolName = 'list-cms-serverless-functions';
|
|
24
23
|
export class HsListFunctionsTool extends Tool {
|
|
25
|
-
constructor(mcpServer) {
|
|
26
|
-
super(mcpServer);
|
|
24
|
+
constructor(mcpServer, logger) {
|
|
25
|
+
super(mcpServer, logger, toolName);
|
|
27
26
|
}
|
|
28
27
|
async handler({ account, json, absoluteCurrentWorkingDirectory, }) {
|
|
29
28
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
30
|
-
await trackToolUsage(toolName);
|
|
31
29
|
let command = 'hs function list';
|
|
32
30
|
if (json) {
|
|
33
31
|
command += ' --json';
|
|
@@ -40,6 +38,10 @@ export class HsListFunctionsTool extends Tool {
|
|
|
40
38
|
return formatTextContents(stdout, stderr);
|
|
41
39
|
}
|
|
42
40
|
catch (error) {
|
|
41
|
+
this.logger.debug(toolName, {
|
|
42
|
+
message: 'Handler caught error',
|
|
43
|
+
error: error instanceof Error ? error.message : String(error),
|
|
44
|
+
});
|
|
43
45
|
return {
|
|
44
46
|
content: [
|
|
45
47
|
{
|
|
@@ -59,6 +61,6 @@ export class HsListFunctionsTool extends Tool {
|
|
|
59
61
|
readOnlyHint: true,
|
|
60
62
|
openWorldHint: true,
|
|
61
63
|
},
|
|
62
|
-
}, this.
|
|
64
|
+
}, input => this.wrappedHandler(input));
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -8,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
8
10
|
}, z.core.$strip>;
|
|
9
11
|
export type HsListInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
10
12
|
export declare class HsListTool extends Tool<HsListInputSchema> {
|
|
11
|
-
constructor(mcpServer: McpServer);
|
|
13
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
12
14
|
handler({ path, account, absoluteCurrentWorkingDirectory, }: HsListInputSchema): Promise<TextContentResponse>;
|
|
13
15
|
register(): RegisteredTool;
|
|
14
16
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
5
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents } from '../../utils/content.js';
|
|
7
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
9
|
const inputSchema = {
|
|
@@ -22,12 +21,11 @@ const inputSchema = {
|
|
|
22
21
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
23
22
|
const toolName = 'list-cms-remote-contents';
|
|
24
23
|
export class HsListTool extends Tool {
|
|
25
|
-
constructor(mcpServer) {
|
|
26
|
-
super(mcpServer);
|
|
24
|
+
constructor(mcpServer, logger) {
|
|
25
|
+
super(mcpServer, logger, toolName);
|
|
27
26
|
}
|
|
28
27
|
async handler({ path, account, absoluteCurrentWorkingDirectory, }) {
|
|
29
28
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
30
|
-
await trackToolUsage(toolName);
|
|
31
29
|
let command = 'hs list';
|
|
32
30
|
if (path) {
|
|
33
31
|
command += ` ${path}`;
|
|
@@ -40,6 +38,10 @@ export class HsListTool extends Tool {
|
|
|
40
38
|
return formatTextContents(stdout, stderr);
|
|
41
39
|
}
|
|
42
40
|
catch (error) {
|
|
41
|
+
this.logger.debug(toolName, {
|
|
42
|
+
message: 'Handler caught error',
|
|
43
|
+
error: error instanceof Error ? error.message : String(error),
|
|
44
|
+
});
|
|
43
45
|
return {
|
|
44
46
|
content: [
|
|
45
47
|
{
|
|
@@ -59,6 +61,6 @@ export class HsListTool extends Tool {
|
|
|
59
61
|
readOnlyHint: true,
|
|
60
62
|
openWorldHint: true,
|
|
61
63
|
},
|
|
62
|
-
}, this.
|
|
64
|
+
}, input => this.wrappedHandler(input));
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
2
|
+
import { McpLogger } from '../utils/logger.js';
|
|
3
|
+
export declare function registerProjectTools(mcpServer: McpServer, logger: McpLogger): RegisteredTool[];
|
|
4
|
+
export declare function registerCmsTools(mcpServer: McpServer, logger: McpLogger): RegisteredTool[];
|
|
@@ -18,31 +18,31 @@ import { HsCreateFunctionTool } from './cms/HsCreateFunctionTool.js';
|
|
|
18
18
|
import { HsListFunctionsTool } from './cms/HsListFunctionsTool.js';
|
|
19
19
|
import { HsFunctionLogsTool } from './cms/HsFunctionLogsTool.js';
|
|
20
20
|
import { CreateTestAccountTool } from './project/CreateTestAccountTool.js';
|
|
21
|
-
export function registerProjectTools(mcpServer) {
|
|
21
|
+
export function registerProjectTools(mcpServer, logger) {
|
|
22
22
|
return [
|
|
23
|
-
new UploadProjectTools(mcpServer).register(),
|
|
24
|
-
new CreateProjectTool(mcpServer).register(),
|
|
25
|
-
new GuidedWalkthroughTool(mcpServer).register(),
|
|
26
|
-
new CreateTestAccountTool(mcpServer).register(),
|
|
27
|
-
new DeployProjectTool(mcpServer).register(),
|
|
28
|
-
new AddFeatureToProjectTool(mcpServer).register(),
|
|
29
|
-
new ValidateProjectTool(mcpServer).register(),
|
|
30
|
-
new GetConfigValuesTool(mcpServer).register(),
|
|
31
|
-
new DocsSearchTool(mcpServer).register(),
|
|
32
|
-
new DocFetchTool(mcpServer).register(),
|
|
33
|
-
new GetApiUsagePatternsByAppIdTool(mcpServer).register(),
|
|
34
|
-
new GetApplicationInfoTool(mcpServer).register(),
|
|
35
|
-
new GetBuildLogsTool(mcpServer).register(),
|
|
36
|
-
new GetBuildStatusTool(mcpServer).register(),
|
|
23
|
+
new UploadProjectTools(mcpServer, logger).register(),
|
|
24
|
+
new CreateProjectTool(mcpServer, logger).register(),
|
|
25
|
+
new GuidedWalkthroughTool(mcpServer, logger).register(),
|
|
26
|
+
new CreateTestAccountTool(mcpServer, logger).register(),
|
|
27
|
+
new DeployProjectTool(mcpServer, logger).register(),
|
|
28
|
+
new AddFeatureToProjectTool(mcpServer, logger).register(),
|
|
29
|
+
new ValidateProjectTool(mcpServer, logger).register(),
|
|
30
|
+
new GetConfigValuesTool(mcpServer, logger).register(),
|
|
31
|
+
new DocsSearchTool(mcpServer, logger).register(),
|
|
32
|
+
new DocFetchTool(mcpServer, logger).register(),
|
|
33
|
+
new GetApiUsagePatternsByAppIdTool(mcpServer, logger).register(),
|
|
34
|
+
new GetApplicationInfoTool(mcpServer, logger).register(),
|
|
35
|
+
new GetBuildLogsTool(mcpServer, logger).register(),
|
|
36
|
+
new GetBuildStatusTool(mcpServer, logger).register(),
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
|
-
export function registerCmsTools(mcpServer) {
|
|
39
|
+
export function registerCmsTools(mcpServer, logger) {
|
|
40
40
|
return [
|
|
41
|
-
new HsListTool(mcpServer).register(),
|
|
42
|
-
new HsCreateModuleTool(mcpServer).register(),
|
|
43
|
-
new HsCreateTemplateTool(mcpServer).register(),
|
|
44
|
-
new HsCreateFunctionTool(mcpServer).register(),
|
|
45
|
-
new HsListFunctionsTool(mcpServer).register(),
|
|
46
|
-
new HsFunctionLogsTool(mcpServer).register(),
|
|
41
|
+
new HsListTool(mcpServer, logger).register(),
|
|
42
|
+
new HsCreateModuleTool(mcpServer, logger).register(),
|
|
43
|
+
new HsCreateTemplateTool(mcpServer, logger).register(),
|
|
44
|
+
new HsCreateFunctionTool(mcpServer, logger).register(),
|
|
45
|
+
new HsListFunctionsTool(mcpServer, logger).register(),
|
|
46
|
+
new HsFunctionLogsTool(mcpServer, logger).register(),
|
|
47
47
|
];
|
|
48
48
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteProjectPath: z.ZodString;
|
|
@@ -20,16 +22,16 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
20
22
|
"workflow-action-tool": "workflow-action-tool";
|
|
21
23
|
page: "page";
|
|
22
24
|
webhooks: "webhooks";
|
|
23
|
-
"workflow-action": "workflow-action";
|
|
24
25
|
"app-function": "app-function";
|
|
25
|
-
"app-function-endpoint": "app-function-endpoint";
|
|
26
26
|
"app-object": "app-object";
|
|
27
27
|
scim: "scim";
|
|
28
|
+
"workflow-action": "workflow-action";
|
|
29
|
+
"app-function-endpoint": "app-function-endpoint";
|
|
28
30
|
}>>>;
|
|
29
31
|
}, z.core.$strip>;
|
|
30
32
|
export type AddFeatureInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
31
33
|
export declare class AddFeatureToProjectTool extends Tool<AddFeatureInputSchema> {
|
|
32
|
-
constructor(mcpServer: McpServer);
|
|
34
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
33
35
|
handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }: AddFeatureInputSchema): Promise<TextContentResponse>;
|
|
34
36
|
register(): RegisteredTool;
|
|
35
37
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, } from '../../../lib/constants.js';
|
|
4
4
|
import { addFlag } from '../../utils/command.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
|
|
6
6
|
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
8
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
9
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
10
9
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
11
10
|
const inputSchema = {
|
|
@@ -30,13 +29,12 @@ const inputSchemaZodObject = z.object({
|
|
|
30
29
|
});
|
|
31
30
|
const toolName = 'add-feature-to-project';
|
|
32
31
|
export class AddFeatureToProjectTool extends Tool {
|
|
33
|
-
constructor(mcpServer) {
|
|
34
|
-
super(mcpServer);
|
|
32
|
+
constructor(mcpServer, logger) {
|
|
33
|
+
super(mcpServer, logger, toolName);
|
|
35
34
|
}
|
|
36
35
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }) {
|
|
37
36
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
38
37
|
try {
|
|
39
|
-
await trackToolUsage(toolName);
|
|
40
38
|
let command = `hs project add`;
|
|
41
39
|
const content = [];
|
|
42
40
|
if (distribution) {
|
|
@@ -62,6 +60,10 @@ export class AddFeatureToProjectTool extends Tool {
|
|
|
62
60
|
return formatTextContents(stdout, stderr);
|
|
63
61
|
}
|
|
64
62
|
catch (error) {
|
|
63
|
+
this.logger.debug(toolName, {
|
|
64
|
+
message: 'Handler caught error',
|
|
65
|
+
error: error instanceof Error ? error.message : String(error),
|
|
66
|
+
});
|
|
65
67
|
return formatTextContents(getErrorMessage(error));
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -77,6 +79,6 @@ export class AddFeatureToProjectTool extends Tool {
|
|
|
77
79
|
idempotentHint: false,
|
|
78
80
|
openWorldHint: false,
|
|
79
81
|
},
|
|
80
|
-
}, this.
|
|
82
|
+
}, input => this.wrappedHandler(input));
|
|
81
83
|
}
|
|
82
84
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
@@ -24,16 +26,16 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
24
26
|
"workflow-action-tool": "workflow-action-tool";
|
|
25
27
|
page: "page";
|
|
26
28
|
webhooks: "webhooks";
|
|
27
|
-
"workflow-action": "workflow-action";
|
|
28
29
|
"app-function": "app-function";
|
|
29
|
-
"app-function-endpoint": "app-function-endpoint";
|
|
30
30
|
"app-object": "app-object";
|
|
31
31
|
scim: "scim";
|
|
32
|
+
"workflow-action": "workflow-action";
|
|
33
|
+
"app-function-endpoint": "app-function-endpoint";
|
|
32
34
|
}>>>;
|
|
33
35
|
}, z.core.$strip>;
|
|
34
36
|
export type CreateProjectInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
35
37
|
export declare class CreateProjectTool extends Tool<CreateProjectInputSchema> {
|
|
36
|
-
constructor(mcpServer: McpServer);
|
|
38
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
37
39
|
handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }: CreateProjectInputSchema): Promise<TextContentResponse>;
|
|
38
40
|
register(): RegisteredTool;
|
|
39
41
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, EMPTY_PROJECT, PROJECT_WITH_APP, } from '../../../lib/constants.js';
|
|
4
4
|
import { addFlag } from '../../utils/command.js';
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, features } from './constants.js';
|
|
6
6
|
import { runCommandInDir } from '../../utils/command.js';
|
|
7
7
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
8
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
9
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
10
9
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
11
|
-
import { PLATFORM_VERSIONS } from '@hubspot/
|
|
10
|
+
import { PLATFORM_VERSIONS } from '@hubspot/project-parsing-lib/constants';
|
|
12
11
|
const inputSchema = {
|
|
13
12
|
absoluteCurrentWorkingDirectory,
|
|
14
13
|
name: z
|
|
@@ -35,12 +34,11 @@ const inputSchema = {
|
|
|
35
34
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
36
35
|
const toolName = 'create-project';
|
|
37
36
|
export class CreateProjectTool extends Tool {
|
|
38
|
-
constructor(mcpServer) {
|
|
39
|
-
super(mcpServer);
|
|
37
|
+
constructor(mcpServer, logger) {
|
|
38
|
+
super(mcpServer, logger, toolName);
|
|
40
39
|
}
|
|
41
40
|
async handler({ name, destination, projectBase, distribution, auth, features, absoluteCurrentWorkingDirectory, }) {
|
|
42
41
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
43
|
-
await trackToolUsage(toolName);
|
|
44
42
|
let command = addFlag('hs project create', 'platform-version', PLATFORM_VERSIONS.v2026_03);
|
|
45
43
|
const content = [];
|
|
46
44
|
if (name) {
|
|
@@ -79,6 +77,10 @@ export class CreateProjectTool extends Tool {
|
|
|
79
77
|
return formatTextContents(stdout, stderr);
|
|
80
78
|
}
|
|
81
79
|
catch (error) {
|
|
80
|
+
this.logger.debug(toolName, {
|
|
81
|
+
message: 'Handler caught error',
|
|
82
|
+
error: error instanceof Error ? error.message : String(error),
|
|
83
|
+
});
|
|
82
84
|
return formatTextContents(getErrorMessage(error));
|
|
83
85
|
}
|
|
84
86
|
}
|
|
@@ -93,6 +95,6 @@ export class CreateProjectTool extends Tool {
|
|
|
93
95
|
idempotentHint: false,
|
|
94
96
|
openWorldHint: false,
|
|
95
97
|
},
|
|
96
|
-
}, this.
|
|
98
|
+
}, input => this.wrappedHandler(input));
|
|
97
99
|
}
|
|
98
100
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import {
|
|
3
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
4
|
+
import { TextContentResponse } from '../../types.js';
|
|
5
|
+
import { Tool } from '../../Tool.js';
|
|
4
6
|
declare const createTestAccountInputSchema: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
6
8
|
configPath: z.ZodOptional<z.ZodString>;
|
|
@@ -44,7 +46,7 @@ declare const createTestAccountInputSchema: z.ZodObject<{
|
|
|
44
46
|
}, z.core.$strip>;
|
|
45
47
|
export type CreateTestAccountInputSchema = z.infer<typeof createTestAccountInputSchema>;
|
|
46
48
|
export declare class CreateTestAccountTool extends Tool<CreateTestAccountInputSchema> {
|
|
47
|
-
constructor(mcpServer: McpServer);
|
|
49
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
48
50
|
handler({ absoluteCurrentWorkingDirectory, name, description, marketingLevel, opsLevel, serviceLevel, salesLevel, contentLevel, commerceLevel, configPath, }: CreateTestAccountInputSchema): Promise<TextContentResponse>;
|
|
49
51
|
register(): RegisteredTool;
|
|
50
52
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
4
3
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
5
4
|
import { addFlag } from '../../utils/command.js';
|
|
6
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
7
6
|
import { ACCOUNT_LEVELS, ACCOUNT_LEVEL_CHOICES, } from '../../../lib/constants.js';
|
|
8
|
-
import { Tool } from '../../
|
|
7
|
+
import { Tool } from '../../Tool.js';
|
|
9
8
|
import { absoluteCurrentWorkingDirectory } from './constants.js';
|
|
10
9
|
import { getConfigAccountByName } from '@hubspot/local-dev-lib/config';
|
|
11
10
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -68,12 +67,11 @@ const inputSchema = {
|
|
|
68
67
|
const createTestAccountInputSchema = z.object({ ...inputSchema });
|
|
69
68
|
const toolName = 'create-test-account';
|
|
70
69
|
export class CreateTestAccountTool extends Tool {
|
|
71
|
-
constructor(mcpServer) {
|
|
72
|
-
super(mcpServer);
|
|
70
|
+
constructor(mcpServer, logger) {
|
|
71
|
+
super(mcpServer, logger, toolName);
|
|
73
72
|
}
|
|
74
73
|
async handler({ absoluteCurrentWorkingDirectory, name, description, marketingLevel, opsLevel, serviceLevel, salesLevel, contentLevel, commerceLevel, configPath, }) {
|
|
75
74
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
76
|
-
await trackToolUsage(toolName);
|
|
77
75
|
let command = 'hs test-account create';
|
|
78
76
|
const content = [];
|
|
79
77
|
// Use config file if provided (LLM should check for config first)
|
|
@@ -84,6 +82,10 @@ export class CreateTestAccountTool extends Tool {
|
|
|
84
82
|
configJson = JSON.parse(config);
|
|
85
83
|
}
|
|
86
84
|
catch (error) {
|
|
85
|
+
this.logger.debug(toolName, {
|
|
86
|
+
message: 'Handler caught error reading config file',
|
|
87
|
+
error: error instanceof Error ? error.message : String(error),
|
|
88
|
+
});
|
|
87
89
|
return {
|
|
88
90
|
content: [
|
|
89
91
|
formatTextContent(`Failed to read or parse config file at "${configPath}": ${getErrorMessage(error)}. Please ensure the file exists and contains valid JSON.`),
|
|
@@ -97,7 +99,10 @@ export class CreateTestAccountTool extends Tool {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
catch (error) {
|
|
100
|
-
|
|
102
|
+
this.logger.debug(toolName, {
|
|
103
|
+
message: 'Handler caught error checking account by config name',
|
|
104
|
+
error: error instanceof Error ? error.message : String(error),
|
|
105
|
+
});
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
108
|
command = addFlag(command, 'config-path', configPath);
|
|
@@ -110,7 +115,10 @@ export class CreateTestAccountTool extends Tool {
|
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
catch (e) {
|
|
113
|
-
|
|
118
|
+
this.logger.debug(toolName, {
|
|
119
|
+
message: 'Handler caught error checking account by name',
|
|
120
|
+
error: e instanceof Error ? e.message : String(e),
|
|
121
|
+
});
|
|
114
122
|
}
|
|
115
123
|
command = addFlag(command, 'name', name);
|
|
116
124
|
command = addFlag(command, 'description', description || name);
|
|
@@ -135,6 +143,10 @@ export class CreateTestAccountTool extends Tool {
|
|
|
135
143
|
return formatTextContents(absoluteCurrentWorkingDirectory, stdout, stderr);
|
|
136
144
|
}
|
|
137
145
|
catch (error) {
|
|
146
|
+
this.logger.debug(toolName, {
|
|
147
|
+
message: 'Handler caught error',
|
|
148
|
+
error: error instanceof Error ? error.message : String(error),
|
|
149
|
+
});
|
|
138
150
|
return formatTextContents(absoluteCurrentWorkingDirectory, getErrorMessage(error));
|
|
139
151
|
}
|
|
140
152
|
}
|
|
@@ -165,6 +177,6 @@ export class CreateTestAccountTool extends Tool {
|
|
|
165
177
|
idempotentHint: false,
|
|
166
178
|
openWorldHint: true,
|
|
167
179
|
},
|
|
168
|
-
}, this.
|
|
180
|
+
}, input => this.wrappedHandler(input));
|
|
169
181
|
}
|
|
170
182
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TextContentResponse
|
|
1
|
+
import { TextContentResponse } from '../../types.js';
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
2
3
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteProjectPath: z.ZodString;
|
|
@@ -8,7 +10,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
8
10
|
}, z.core.$strip>;
|
|
9
11
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
10
12
|
export declare class DeployProjectTool extends Tool<InputSchemaType> {
|
|
11
|
-
constructor(mcpServer: McpServer);
|
|
13
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
12
14
|
handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildNumber, }: InputSchemaType): Promise<TextContentResponse>;
|
|
13
15
|
register(): RegisteredTool;
|
|
14
16
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { addFlag } from '../../utils/command.js';
|
|
4
4
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
5
5
|
import { runCommandInDir } from '../../utils/command.js';
|
|
6
6
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
7
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
8
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
8
|
const inputSchema = {
|
|
10
9
|
absoluteProjectPath,
|
|
@@ -19,12 +18,11 @@ const inputSchemaZodObject = z.object({
|
|
|
19
18
|
});
|
|
20
19
|
const toolName = 'deploy-project';
|
|
21
20
|
export class DeployProjectTool extends Tool {
|
|
22
|
-
constructor(mcpServer) {
|
|
23
|
-
super(mcpServer);
|
|
21
|
+
constructor(mcpServer, logger) {
|
|
22
|
+
super(mcpServer, logger, toolName);
|
|
24
23
|
}
|
|
25
24
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildNumber, }) {
|
|
26
25
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
27
|
-
await trackToolUsage(toolName);
|
|
28
26
|
let command = `hs project deploy`;
|
|
29
27
|
const content = [];
|
|
30
28
|
if (!buildNumber) {
|
|
@@ -53,6 +51,6 @@ export class DeployProjectTool extends Tool {
|
|
|
53
51
|
idempotentHint: true,
|
|
54
52
|
openWorldHint: true,
|
|
55
53
|
},
|
|
56
|
-
}, this.
|
|
54
|
+
}, input => this.wrappedHandler(input));
|
|
57
55
|
}
|
|
58
56
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
2
3
|
import z from 'zod';
|
|
3
|
-
import { TextContentResponse
|
|
4
|
+
import { TextContentResponse } from '../../types.js';
|
|
5
|
+
import { Tool } from '../../Tool.js';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
docUrl: z.ZodString;
|
|
6
8
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
7
9
|
}, z.z.core.$strip>;
|
|
8
10
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
9
11
|
export declare class DocFetchTool extends Tool<InputSchemaType> {
|
|
10
|
-
constructor(mcpServer: McpServer);
|
|
12
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
11
13
|
handler({ docUrl, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
|
|
12
14
|
register(): RegisteredTool;
|
|
13
15
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import { Tool } from '../../
|
|
2
|
+
import { Tool } from '../../Tool.js';
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
5
4
|
import { absoluteCurrentWorkingDirectory, docUrl } from './constants.js';
|
|
6
5
|
import { http } from '@hubspot/local-dev-lib/http/unauthed';
|
|
7
6
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
@@ -17,12 +16,11 @@ const inputSchemaZodObject = z.object({
|
|
|
17
16
|
});
|
|
18
17
|
const toolName = 'fetch-doc';
|
|
19
18
|
export class DocFetchTool extends Tool {
|
|
20
|
-
constructor(mcpServer) {
|
|
21
|
-
super(mcpServer);
|
|
19
|
+
constructor(mcpServer, logger) {
|
|
20
|
+
super(mcpServer, logger, toolName);
|
|
22
21
|
}
|
|
23
22
|
async handler({ docUrl, absoluteCurrentWorkingDirectory, }) {
|
|
24
23
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
25
|
-
await trackToolUsage(toolName);
|
|
26
24
|
try {
|
|
27
25
|
// Append .md extension to the URL
|
|
28
26
|
const markdownUrl = `${docUrl}.md`;
|
|
@@ -36,6 +34,10 @@ export class DocFetchTool extends Tool {
|
|
|
36
34
|
return formatTextContents(content);
|
|
37
35
|
}
|
|
38
36
|
catch (error) {
|
|
37
|
+
this.logger.debug(toolName, {
|
|
38
|
+
message: 'Handler caught error',
|
|
39
|
+
error: error instanceof Error ? error.message : String(error),
|
|
40
|
+
});
|
|
39
41
|
if (isHubSpotHttpError(error)) {
|
|
40
42
|
return formatTextContents(error.toString());
|
|
41
43
|
}
|
|
@@ -52,6 +54,6 @@ export class DocFetchTool extends Tool {
|
|
|
52
54
|
readOnlyHint: true,
|
|
53
55
|
openWorldHint: true,
|
|
54
56
|
},
|
|
55
|
-
}, this.
|
|
57
|
+
}, input => this.wrappedHandler(input));
|
|
56
58
|
}
|
|
57
59
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { McpLogger } from '../../utils/logger.js';
|
|
2
3
|
import z from 'zod';
|
|
3
|
-
import { TextContentResponse
|
|
4
|
+
import { TextContentResponse } from '../../types.js';
|
|
5
|
+
import { Tool } from '../../Tool.js';
|
|
4
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
5
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
6
8
|
docsSearchQuery: z.ZodString;
|
|
9
|
+
docsSearchLimit: z.ZodDefault<z.ZodNumber>;
|
|
7
10
|
}, z.z.core.$strip>;
|
|
8
11
|
export interface DocsSearchResponse {
|
|
9
12
|
results: {
|
|
@@ -16,8 +19,11 @@ export interface DocsSearchResponse {
|
|
|
16
19
|
}
|
|
17
20
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
18
21
|
export declare class DocsSearchTool extends Tool<InputSchemaType> {
|
|
19
|
-
constructor(mcpServer: McpServer);
|
|
20
|
-
|
|
22
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
23
|
+
protected getTrackingMeta({ docsSearchQuery, }: InputSchemaType): {
|
|
24
|
+
[key: string]: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
handler({ docsSearchQuery, docsSearchLimit, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<TextContentResponse>;
|
|
21
27
|
register(): RegisteredTool;
|
|
22
28
|
}
|
|
23
29
|
export {};
|