@hubspot/cli 8.5.0-beta.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 +2 -0
- package/lang/en.js +6 -4
- package/lib/app/migrate.js +7 -0
- package/lib/doctor/Doctor.js +2 -2
- package/lib/getStartedV2Actions.js +2 -2
- 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 +2 -2
- 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 +4 -4
- 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
|
@@ -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 {};
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
2
2
|
import z from 'zod';
|
|
3
|
-
import { Tool } from '../../
|
|
3
|
+
import { Tool } from '../../Tool.js';
|
|
4
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
6
5
|
import { absoluteCurrentWorkingDirectory, docsSearchQuery, } from './constants.js';
|
|
7
6
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
8
7
|
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
9
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
10
9
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
|
+
const docsSearchLimit = z
|
|
11
|
+
.number()
|
|
12
|
+
.int()
|
|
13
|
+
.min(1)
|
|
14
|
+
.max(20)
|
|
15
|
+
.default(5)
|
|
16
|
+
.describe('Maximum number of results to return.');
|
|
11
17
|
const inputSchema = {
|
|
12
18
|
absoluteCurrentWorkingDirectory,
|
|
13
19
|
docsSearchQuery,
|
|
20
|
+
docsSearchLimit,
|
|
14
21
|
};
|
|
15
22
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
23
|
const inputSchemaZodObject = z.object({
|
|
@@ -18,12 +25,14 @@ const inputSchemaZodObject = z.object({
|
|
|
18
25
|
});
|
|
19
26
|
const toolName = 'search-docs';
|
|
20
27
|
export class DocsSearchTool extends Tool {
|
|
21
|
-
constructor(mcpServer) {
|
|
22
|
-
super(mcpServer);
|
|
28
|
+
constructor(mcpServer, logger) {
|
|
29
|
+
super(mcpServer, logger, toolName);
|
|
23
30
|
}
|
|
24
|
-
|
|
31
|
+
getTrackingMeta({ docsSearchQuery, }) {
|
|
32
|
+
return { mode: docsSearchQuery };
|
|
33
|
+
}
|
|
34
|
+
async handler({ docsSearchQuery, docsSearchLimit, absoluteCurrentWorkingDirectory, }) {
|
|
25
35
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
26
|
-
await trackToolUsage(toolName, { mode: docsSearchQuery });
|
|
27
36
|
const accountId = getConfigDefaultAccountIfExists()?.accountId;
|
|
28
37
|
if (!accountId) {
|
|
29
38
|
const authErrorMessage = `No account ID found. Please run \`hs account auth\` to configure an account, or set a default account with \`hs account use <account>\``;
|
|
@@ -40,13 +49,27 @@ export class DocsSearchTool extends Tool {
|
|
|
40
49
|
if (!results || results.length === 0) {
|
|
41
50
|
return formatTextContents('No documentation found for your query.');
|
|
42
51
|
}
|
|
43
|
-
|
|
52
|
+
// The docs-search API returns duplicate URLs; dedupe to avoid wasting the result limit on repeats
|
|
53
|
+
const seen = new Set();
|
|
54
|
+
const dedupedResults = results.filter(result => {
|
|
55
|
+
if (seen.has(result.url)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
seen.add(result.url);
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
const limitedResults = dedupedResults.slice(0, docsSearchLimit);
|
|
62
|
+
const formattedResults = limitedResults
|
|
44
63
|
.map(result => `**${result.title}**\n${result.description}\nURL: ${result.url}\nScore: ${result.score}\n\n${result.content}\n---\n`)
|
|
45
64
|
.join('\n');
|
|
46
|
-
const successMessage = `Found ${
|
|
65
|
+
const successMessage = `Found ${dedupedResults.length} results, showing top ${limitedResults.length}:\n\n${formattedResults}`;
|
|
47
66
|
return formatTextContents(successMessage);
|
|
48
67
|
}
|
|
49
68
|
catch (error) {
|
|
69
|
+
this.logger.debug(toolName, {
|
|
70
|
+
message: 'Handler caught error',
|
|
71
|
+
error: error instanceof Error ? error.message : String(error),
|
|
72
|
+
});
|
|
50
73
|
if (isHubSpotHttpError(error)) {
|
|
51
74
|
// Handle different status codes
|
|
52
75
|
return formatTextContents(error.toString());
|
|
@@ -64,6 +87,6 @@ export class DocsSearchTool extends Tool {
|
|
|
64
87
|
readOnlyHint: true,
|
|
65
88
|
openWorldHint: true,
|
|
66
89
|
},
|
|
67
|
-
}, this.
|
|
90
|
+
}, input => this.wrappedHandler(input));
|
|
68
91
|
}
|
|
69
92
|
}
|
|
@@ -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;
|
|
@@ -9,7 +11,7 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
9
11
|
}, z.core.$strip>;
|
|
10
12
|
export type GetApiUsagePatternsByAppIdInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
11
13
|
export declare class GetApiUsagePatternsByAppIdTool extends Tool<GetApiUsagePatternsByAppIdInputSchema> {
|
|
12
|
-
constructor(mcpServer: McpServer);
|
|
14
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
13
15
|
handler({ appId, startDate, endDate, absoluteCurrentWorkingDirectory, }: GetApiUsagePatternsByAppIdInputSchema): Promise<TextContentResponse>;
|
|
14
16
|
register(): RegisteredTool;
|
|
15
17
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Tool } from '../../
|
|
1
|
+
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { trackToolUsage } from '../../utils/toolUsageTracking.js';
|
|
4
3
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
5
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
6
5
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
@@ -26,12 +25,11 @@ const inputSchema = {
|
|
|
26
25
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
27
26
|
const toolName = 'get-api-usage-patterns-by-app-id';
|
|
28
27
|
export class GetApiUsagePatternsByAppIdTool extends Tool {
|
|
29
|
-
constructor(mcpServer) {
|
|
30
|
-
super(mcpServer);
|
|
28
|
+
constructor(mcpServer, logger) {
|
|
29
|
+
super(mcpServer, logger, toolName);
|
|
31
30
|
}
|
|
32
31
|
async handler({ appId, startDate, endDate, absoluteCurrentWorkingDirectory, }) {
|
|
33
32
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
34
|
-
await trackToolUsage(toolName);
|
|
35
33
|
try {
|
|
36
34
|
// Get account ID from CLI config
|
|
37
35
|
const accountId = getConfigDefaultAccountIfExists()?.accountId;
|
|
@@ -52,6 +50,10 @@ export class GetApiUsagePatternsByAppIdTool extends Tool {
|
|
|
52
50
|
return formatTextContents(formattedResult);
|
|
53
51
|
}
|
|
54
52
|
catch (error) {
|
|
53
|
+
this.logger.debug(toolName, {
|
|
54
|
+
message: 'Handler caught error',
|
|
55
|
+
error: error instanceof Error ? error.message : String(error),
|
|
56
|
+
});
|
|
55
57
|
if (isHubSpotHttpError(error)) {
|
|
56
58
|
// Handle HubSpot-specific HTTP errors
|
|
57
59
|
return formatTextContents(error.toString());
|
|
@@ -68,6 +70,6 @@ export class GetApiUsagePatternsByAppIdTool extends Tool {
|
|
|
68
70
|
readOnlyHint: true,
|
|
69
71
|
openWorldHint: true,
|
|
70
72
|
},
|
|
71
|
-
}, this.
|
|
73
|
+
}, input => this.wrappedHandler(input));
|
|
72
74
|
}
|
|
73
75
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
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;
|
|
6
8
|
}, z.core.$strip>;
|
|
7
9
|
export type GetApplicationInfoInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
8
10
|
export declare class GetApplicationInfoTool extends Tool<GetApplicationInfoInputSchema> {
|
|
9
|
-
constructor(mcpServer: McpServer);
|
|
11
|
+
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
10
12
|
handler({ absoluteCurrentWorkingDirectory, }: GetApplicationInfoInputSchema): Promise<TextContentResponse>;
|
|
11
13
|
register(): RegisteredTool;
|
|
12
14
|
}
|