@hubspot/cli 8.15.0 → 8.16.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/releases.d.ts +4 -1
- package/bin/cli.js +2 -0
- package/commands/account/auth.d.ts +3 -2
- package/commands/account/auth.js +21 -10
- package/commands/app/migrate.js +3 -3
- package/commands/project/add.d.ts +3 -2
- package/commands/project/add.js +10 -8
- package/commands/project/appInstallStatus.d.ts +2 -2
- package/commands/project/appInstallStatus.js +2 -2
- package/commands/project/create.d.ts +4 -2
- package/commands/project/create.js +16 -4
- package/commands/project/deploy.d.ts +2 -2
- package/commands/project/deploy.js +2 -2
- package/commands/project/download.d.ts +2 -2
- package/commands/project/download.js +2 -2
- package/commands/project/info.d.ts +1 -1
- package/commands/project/info.js +1 -1
- package/commands/project/installApp.d.ts +2 -2
- package/commands/project/installApp.js +2 -2
- package/commands/project/listBuilds.d.ts +2 -2
- package/commands/project/listBuilds.js +2 -2
- package/commands/project/migrate.js +4 -4
- package/commands/project/release/create.d.ts +2 -2
- package/commands/project/release/create.js +7 -3
- package/commands/project/release/info.d.ts +2 -2
- package/commands/project/release/info.js +2 -2
- package/commands/project/release/list.d.ts +2 -2
- package/commands/project/release/list.js +2 -2
- package/commands/project/release/preview.d.ts +9 -0
- package/commands/project/release/preview.js +167 -0
- package/commands/project/release.js +7 -1
- package/commands/project/upload.d.ts +2 -2
- package/commands/project/upload.js +2 -2
- package/commands/project/validate.d.ts +2 -2
- package/commands/project/validate.js +2 -2
- package/commands/testAccount/create.d.ts +2 -2
- package/commands/testAccount/create.js +2 -2
- package/lang/en.d.ts +27 -0
- package/lang/en.js +32 -4
- package/lib/accountAuth.d.ts +1 -0
- package/lib/accountAuth.js +8 -0
- package/lib/app/urls.d.ts +0 -1
- package/lib/app/urls.js +0 -4
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +11 -0
- package/lib/jsonOutput/accountAuth.d.ts +7 -0
- package/lib/jsonOutput/accountAuth.js +6 -0
- package/lib/jsonOutput/projectAdd.d.ts +9 -0
- package/lib/jsonOutput/projectAdd.js +10 -0
- package/lib/jsonOutput/{appInstallStatus.d.ts → projectAppInstallStatus.d.ts} +2 -2
- package/lib/jsonOutput/{appInstallStatus.js → projectAppInstallStatus.js} +1 -1
- package/lib/jsonOutput/projectCreate.d.ts +8 -0
- package/lib/jsonOutput/projectCreate.js +7 -0
- package/lib/jsonOutput/projectDeploy.d.ts +5 -0
- package/lib/jsonOutput/{deploy.js → projectDeploy.js} +1 -1
- package/lib/jsonOutput/projectDownload.d.ts +7 -0
- package/lib/jsonOutput/{download.js → projectDownload.js} +1 -1
- package/lib/jsonOutput/{installApp.d.ts → projectInstallApp.d.ts} +2 -2
- package/lib/jsonOutput/{installApp.js → projectInstallApp.js} +1 -1
- package/lib/jsonOutput/{listBuilds.d.ts → projectListBuilds.d.ts} +2 -2
- package/lib/jsonOutput/{listBuilds.js → projectListBuilds.js} +1 -1
- package/lib/jsonOutput/{release.d.ts → projectRelease.d.ts} +15 -8
- package/lib/jsonOutput/{release.js → projectRelease.js} +11 -4
- package/lib/jsonOutput/{upload.d.ts → projectUpload.d.ts} +2 -2
- package/lib/jsonOutput/{upload.js → projectUpload.js} +1 -1
- package/lib/jsonOutput/{validate.d.ts → projectValidate.d.ts} +2 -2
- package/lib/jsonOutput/{validate.js → projectValidate.js} +1 -1
- package/lib/jsonOutput/{createTestAccount.d.ts → testAccountCreate.d.ts} +2 -2
- package/lib/jsonOutput/{createTestAccount.js → testAccountCreate.js} +1 -1
- package/lib/middleware/deprecationWarningMiddleware.d.ts +1 -0
- package/lib/middleware/deprecationWarningMiddleware.js +57 -0
- package/lib/projects/add/legacyAddComponent.d.ts +2 -1
- package/lib/projects/add/legacyAddComponent.js +3 -0
- package/lib/projects/add/v2AddComponent.d.ts +2 -1
- package/lib/projects/add/v2AddComponent.js +7 -1
- package/lib/projects/localDev/LocalDevWatcher.js +1 -1
- package/lib/projects/release.d.ts +2 -2
- package/lib/projects/validate.d.ts +1 -1
- package/lib/prompts/projectProfilePrompt.d.ts +7 -0
- package/lib/prompts/projectProfilePrompt.js +1 -1
- package/lib/testUtils.d.ts +5 -0
- package/lib/testUtils.js +24 -0
- package/lib/ui/index.js +11 -1
- package/lib/ui/uiMessages.d.ts +1 -0
- package/lib/ui/uiMessages.js +1 -0
- package/mcp-server/Tool.d.ts +6 -1
- package/mcp-server/Tool.js +6 -4
- package/mcp-server/server.js +26 -4
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +59 -5
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/index.js +2 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +31 -31
- package/mcp-server/tools/project/AuthAccountTool.d.ts +1 -0
- package/mcp-server/tools/project/AuthAccountTool.js +36 -5
- package/mcp-server/tools/project/CreateProjectTool.js +13 -3
- package/mcp-server/tools/project/CreateTestAccountTool.js +13 -13
- package/mcp-server/tools/project/DeployProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/DeployProjectTool.js +34 -16
- package/mcp-server/tools/project/DocFetchTool.js +1 -1
- package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocsSearchTool.js +18 -9
- package/mcp-server/tools/project/FindProjectsTool.js +12 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +3 -2
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +38 -10
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +2 -1
- package/mcp-server/tools/project/GetApplicationInfoTool.js +13 -14
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +2 -1
- package/mcp-server/tools/project/GetBuildLogsTool.js +12 -9
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +2 -1
- package/mcp-server/tools/project/GetBuildStatusTool.js +12 -9
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +2 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +11 -8
- package/mcp-server/tools/project/KnowledgeSearchTool.d.ts +29 -0
- package/mcp-server/tools/project/KnowledgeSearchTool.js +82 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +2 -2
- package/mcp-server/tools/project/UploadProjectTools.js +52 -39
- package/mcp-server/tools/project/ValidateProjectTool.js +23 -7
- package/mcp-server/tools/project/apps.d.ts +8 -0
- package/mcp-server/tools/project/apps.js +7 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +11 -1
- package/mcp-server/tools/project/productionConfirmation.d.ts +12 -0
- package/mcp-server/tools/project/productionConfirmation.js +45 -0
- package/mcp-server/tools/project/resolveAccount.d.ts +15 -0
- package/mcp-server/tools/project/resolveAccount.js +60 -0
- package/mcp-server/utils/command.d.ts +1 -0
- package/mcp-server/utils/command.js +8 -0
- package/mcp-server/utils/content.d.ts +1 -0
- package/mcp-server/utils/content.js +5 -0
- package/mcp-server/utils/elicitSelection.d.ts +11 -0
- package/mcp-server/utils/elicitSelection.js +25 -0
- package/mcp-server/utils/elicitation.d.ts +11 -0
- package/mcp-server/utils/elicitation.js +38 -0
- package/package.json +23 -22
- package/ui/components/Table.d.ts +8 -8
- package/lib/jsonOutput/deploy.d.ts +0 -5
- package/lib/jsonOutput/download.d.ts +0 -7
- /package/lib/jsonOutput/{info.d.ts → projectInfo.d.ts} +0 -0
- /package/lib/jsonOutput/{info.js → projectInfo.js} +0 -0
|
@@ -5,11 +5,15 @@ import { absoluteCurrentWorkingDirectory } from '../project/constants.js';
|
|
|
5
5
|
import { formatTextContents } from '../../utils/content.js';
|
|
6
6
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
7
7
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
8
|
+
import { getRoutes } from '@hubspot/local-dev-lib/api/functions';
|
|
9
|
+
import { discoverAccountTargets } from '../../../lib/accountTargetDiscovery.js';
|
|
10
|
+
import { elicitSelection } from '../../utils/elicitSelection.js';
|
|
8
11
|
const inputSchema = {
|
|
9
12
|
absoluteCurrentWorkingDirectory,
|
|
10
13
|
endpoint: z
|
|
11
14
|
.string()
|
|
12
|
-
.describe('The function endpoint/path to get logs for.
|
|
15
|
+
.describe('The function endpoint/path to get logs for. Example: "my-function" or "api/my-endpoint" (leading slash will be automatically removed). If omitted and the account has several functions, you will be asked to choose one.')
|
|
16
|
+
.optional(),
|
|
13
17
|
account: z
|
|
14
18
|
.string()
|
|
15
19
|
.describe('The HubSpot account id or name from the HubSpot config file to use for the operation.')
|
|
@@ -33,10 +37,60 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
33
37
|
}
|
|
34
38
|
async handler({ endpoint, account, latest, compact, limit, absoluteCurrentWorkingDirectory, }, extra) {
|
|
35
39
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
40
|
+
let resolvedEndpoint = endpoint;
|
|
41
|
+
if (!resolvedEndpoint) {
|
|
42
|
+
const { recommended } = await discoverAccountTargets({
|
|
43
|
+
explicitAccount: account,
|
|
44
|
+
});
|
|
45
|
+
const accountId = recommended?.accountId;
|
|
46
|
+
if (!accountId) {
|
|
47
|
+
return formatTextContents('No account ID found. Call the auth-account tool to authenticate a HubSpot account.');
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const routesResponse = await getRoutes(accountId);
|
|
51
|
+
const routes = routesResponse.data.objects ?? [];
|
|
52
|
+
if (routes.length === 0) {
|
|
53
|
+
return formatTextContents('No CMS serverless functions found for this account.');
|
|
54
|
+
}
|
|
55
|
+
// The logs command takes a path (method-agnostic), and a path can
|
|
56
|
+
// appear under multiple methods, so dedupe by route to keep the
|
|
57
|
+
// elicitation values unique.
|
|
58
|
+
const seenRoutes = new Set();
|
|
59
|
+
const options = [];
|
|
60
|
+
routes.forEach(route => {
|
|
61
|
+
if (seenRoutes.has(route.route)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
seenRoutes.add(route.route);
|
|
65
|
+
options.push({
|
|
66
|
+
value: route.route,
|
|
67
|
+
label: `${route.method} ${route.route}`,
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
const selected = await elicitSelection(this.mcpServer, this.logger, {
|
|
71
|
+
message: 'Select the CMS serverless function to get logs for.',
|
|
72
|
+
title: 'CMS serverless function',
|
|
73
|
+
options,
|
|
74
|
+
});
|
|
75
|
+
if (!selected) {
|
|
76
|
+
return formatTextContents(`Several functions are available. Ask the user which to use, then call ${toolName} again with the endpoint argument set to one of: ${options
|
|
77
|
+
.map(option => option.label)
|
|
78
|
+
.join(', ')}.`);
|
|
79
|
+
}
|
|
80
|
+
resolvedEndpoint = selected;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
this.logger.debug(toolName, {
|
|
84
|
+
message: 'Failed to list functions for elicitation',
|
|
85
|
+
error: getErrorMessage(error),
|
|
86
|
+
});
|
|
87
|
+
return formatTextContents(`Error listing CMS serverless functions: ${getErrorMessage(error)}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
36
90
|
// Ensure endpoint doesn't start with '/'
|
|
37
|
-
const normalizedEndpoint =
|
|
38
|
-
?
|
|
39
|
-
:
|
|
91
|
+
const normalizedEndpoint = resolvedEndpoint.startsWith('/')
|
|
92
|
+
? resolvedEndpoint.slice(1)
|
|
93
|
+
: resolvedEndpoint;
|
|
40
94
|
const command = new HubSpotCommand(`cms function logs ${normalizedEndpoint}`);
|
|
41
95
|
if (latest) {
|
|
42
96
|
command.addFlag('latest', latest);
|
|
@@ -65,7 +119,7 @@ export class HsFunctionLogsTool extends Tool {
|
|
|
65
119
|
register() {
|
|
66
120
|
return this.mcpServer.registerTool(toolName, {
|
|
67
121
|
title: 'Get HubSpot CMS serverless function logs for an endpoint',
|
|
68
|
-
description: 'Retrieve logs for HubSpot CMS serverless functions. Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
|
|
122
|
+
description: 'Retrieve logs for HubSpot CMS serverless functions. These are CMS/website functions, not developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Use this tool to help debug issues with serverless functions by reading the production logs. Supports various options like latest, compact, and limiting results. Use after listing functions with list-cms-serverless-functions to get the endpoint path.',
|
|
69
123
|
inputSchema,
|
|
70
124
|
annotations: {
|
|
71
125
|
readOnlyHint: true,
|
|
@@ -54,7 +54,7 @@ export class HsListFunctionsTool extends Tool {
|
|
|
54
54
|
register() {
|
|
55
55
|
return this.mcpServer.registerTool(toolName, {
|
|
56
56
|
title: 'List HubSpot CMS Serverless Functions',
|
|
57
|
-
description: '
|
|
57
|
+
description: 'Lists CMS serverless functions deployed in a HubSpot account. CMS serverless functions are website endpoints served at /hs/serverless/<path>. This does NOT list developer-platform app functions (the private app-function feature or the public app-function-endpoint feature). Shows function routes, HTTP methods, secrets, and timestamps.',
|
|
58
58
|
inputSchema,
|
|
59
59
|
annotations: {
|
|
60
60
|
readOnlyHint: true,
|
|
@@ -7,6 +7,7 @@ import { ValidateProjectTool } from './project/ValidateProjectTool.js';
|
|
|
7
7
|
import { GetConfigValuesTool } from './project/GetConfigValuesTool.js';
|
|
8
8
|
import { DocsSearchTool } from './project/DocsSearchTool.js';
|
|
9
9
|
import { DocFetchTool } from './project/DocFetchTool.js';
|
|
10
|
+
import { KnowledgeSearchTool } from './project/KnowledgeSearchTool.js';
|
|
10
11
|
import { GetApiUsagePatternsByAppIdTool } from './project/GetApiUsagePatternsByAppIdTool.js';
|
|
11
12
|
import { GetApplicationInfoTool } from './project/GetApplicationInfoTool.js';
|
|
12
13
|
import { GetBuildLogsTool } from './project/GetBuildLogsTool.js';
|
|
@@ -32,6 +33,7 @@ export function registerProjectTools(mcpServer, logger) {
|
|
|
32
33
|
new GetConfigValuesTool(mcpServer, logger).register(),
|
|
33
34
|
new DocsSearchTool(mcpServer, logger).register(),
|
|
34
35
|
new DocFetchTool(mcpServer, logger).register(),
|
|
36
|
+
new KnowledgeSearchTool(mcpServer, logger).register(),
|
|
35
37
|
new GetApiUsagePatternsByAppIdTool(mcpServer, logger).register(),
|
|
36
38
|
new GetApplicationInfoTool(mcpServer, logger).register(),
|
|
37
39
|
new GetBuildLogsTool(mcpServer, logger).register(),
|
|
@@ -5,7 +5,8 @@ import { HubSpotCommand } from '../../utils/command.js';
|
|
|
5
5
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, features, } from './constants.js';
|
|
6
6
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
|
-
import {
|
|
8
|
+
import { parseCommandJsonOutput } from '../../utils/json.js';
|
|
9
|
+
import { ProjectAddSchema } from '../../../lib/jsonOutput/projectAdd.js';
|
|
9
10
|
const inputSchema = {
|
|
10
11
|
absoluteProjectPath,
|
|
11
12
|
absoluteCurrentWorkingDirectory,
|
|
@@ -33,38 +34,36 @@ export class AddFeatureToProjectTool extends Tool {
|
|
|
33
34
|
}
|
|
34
35
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, distribution, auth, features, addApp, }, extra) {
|
|
35
36
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
else if (addApp) {
|
|
43
|
-
content.push(formatTextContent(`Ask the user how they would you like to distribute the app. Options are ${APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${APP_DISTRIBUTION_TYPES.PRIVATE}`));
|
|
44
|
-
}
|
|
45
|
-
if (auth) {
|
|
46
|
-
command.addFlag('auth', auth);
|
|
47
|
-
}
|
|
48
|
-
else if (addApp) {
|
|
49
|
-
content.push(formatTextContent(`Ask the user which auth type they would like to use. Options are ${APP_AUTH_TYPES.STATIC} and ${APP_AUTH_TYPES.OAUTH}`));
|
|
50
|
-
}
|
|
51
|
-
if (content.length > 0) {
|
|
52
|
-
return {
|
|
53
|
-
content,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
// If features isn't provided, pass an empty array to bypass the prompt
|
|
57
|
-
command.addFlag('features', features || []);
|
|
58
|
-
const { stdout, stderr } = await this.runCommand(absoluteProjectPath, command, extra);
|
|
59
|
-
return formatTextContents(stdout, stderr);
|
|
37
|
+
const command = new HubSpotCommand('project add', [
|
|
38
|
+
{ name: 'json', value: true },
|
|
39
|
+
]);
|
|
40
|
+
const content = [];
|
|
41
|
+
if (distribution) {
|
|
42
|
+
command.addFlag('distribution', distribution);
|
|
60
43
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
message: 'Handler caught error',
|
|
64
|
-
error: error instanceof Error ? error.message : String(error),
|
|
65
|
-
});
|
|
66
|
-
return formatTextContents(getErrorMessage(error));
|
|
44
|
+
else if (addApp) {
|
|
45
|
+
content.push(formatTextContent(`Ask the user how they would you like to distribute the app. Options are ${APP_DISTRIBUTION_TYPES.MARKETPLACE} and ${APP_DISTRIBUTION_TYPES.PRIVATE}`));
|
|
67
46
|
}
|
|
47
|
+
if (auth) {
|
|
48
|
+
command.addFlag('auth', auth);
|
|
49
|
+
}
|
|
50
|
+
else if (addApp) {
|
|
51
|
+
content.push(formatTextContent(`Ask the user which auth type they would like to use. Options are ${APP_AUTH_TYPES.STATIC} and ${APP_AUTH_TYPES.OAUTH}`));
|
|
52
|
+
}
|
|
53
|
+
if (content.length > 0) {
|
|
54
|
+
return {
|
|
55
|
+
content,
|
|
56
|
+
structuredContent: {},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// If features isn't provided, pass an empty array to bypass the prompt
|
|
60
|
+
command.addFlag('features', features || []);
|
|
61
|
+
const { stdout, stderr } = await this.runCommand(absoluteProjectPath, command, extra);
|
|
62
|
+
const response = await formatTextContents(stdout, stderr);
|
|
63
|
+
response.structuredContent =
|
|
64
|
+
parseCommandJsonOutput(stdout, ProjectAddSchema, this.logger, toolName) ??
|
|
65
|
+
{};
|
|
66
|
+
return response;
|
|
68
67
|
}
|
|
69
68
|
register() {
|
|
70
69
|
return this.mcpServer.registerTool(toolName, {
|
|
@@ -72,6 +71,7 @@ export class AddFeatureToProjectTool extends Tool {
|
|
|
72
71
|
description: `Adds a feature to an existing HubSpot project.
|
|
73
72
|
Only works for projects with platformVersion '2025.2' and beyond. If you do not know the project path, use the find-projects tool first to locate HubSpot projects in the workspace.`,
|
|
74
73
|
inputSchema,
|
|
74
|
+
outputSchema: ProjectAddSchema.shape,
|
|
75
75
|
annotations: {
|
|
76
76
|
readOnlyHint: false,
|
|
77
77
|
destructiveHint: false,
|
|
@@ -13,6 +13,7 @@ export type AuthAccountInputSchema = z.infer<typeof inputSchemaZodObject>;
|
|
|
13
13
|
export declare class AuthAccountTool extends Tool<AuthAccountInputSchema> {
|
|
14
14
|
constructor(mcpServer: McpServer, logger: McpLogger);
|
|
15
15
|
handler({ absoluteCurrentWorkingDirectory, accountId, name, setAsDefault, }: AuthAccountInputSchema, extra?: ToolExtra): Promise<McpToolResponse>;
|
|
16
|
+
private resolveSetAsDefault;
|
|
16
17
|
register(): RegisteredTool;
|
|
17
18
|
}
|
|
18
19
|
export {};
|
|
@@ -3,8 +3,12 @@ import { Tool } from '../../Tool.js';
|
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
4
|
import { HubSpotCommand } from '../../utils/command.js';
|
|
5
5
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
6
|
+
import { parseCommandJsonOutput } from '../../utils/json.js';
|
|
7
|
+
import { booleanField } from '../../utils/elicitation.js';
|
|
6
8
|
import { absoluteCurrentWorkingDirectory } from './constants.js';
|
|
7
9
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
|
+
import { getCurrentDefaultAccount } from '../../../lib/accountAuth.js';
|
|
11
|
+
import { AccountAuthSchema } from '../../../lib/jsonOutput/accountAuth.js';
|
|
8
12
|
const inputSchema = {
|
|
9
13
|
absoluteCurrentWorkingDirectory,
|
|
10
14
|
accountId: z
|
|
@@ -18,7 +22,7 @@ const inputSchema = {
|
|
|
18
22
|
setAsDefault: z
|
|
19
23
|
.boolean()
|
|
20
24
|
.optional()
|
|
21
|
-
.describe('
|
|
25
|
+
.describe('Optional: set this account as the default for CLI operations. Omit unless the user stated a preference. If omitted and another account is already the default, the user is asked whether to replace it.'),
|
|
22
26
|
};
|
|
23
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
28
|
const inputSchemaZodObject = z.object({ ...inputSchema });
|
|
@@ -29,7 +33,9 @@ export class AuthAccountTool extends Tool {
|
|
|
29
33
|
}
|
|
30
34
|
async handler({ absoluteCurrentWorkingDirectory, accountId, name, setAsDefault, }, extra) {
|
|
31
35
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
32
|
-
const command = new HubSpotCommand('account auth'
|
|
36
|
+
const command = new HubSpotCommand('account auth', [
|
|
37
|
+
{ name: 'json', value: true },
|
|
38
|
+
]);
|
|
33
39
|
if (name) {
|
|
34
40
|
command.addFlag('name', name);
|
|
35
41
|
}
|
|
@@ -39,10 +45,16 @@ export class AuthAccountTool extends Tool {
|
|
|
39
45
|
if (accountId !== undefined) {
|
|
40
46
|
command.addFlag('account', accountId);
|
|
41
47
|
}
|
|
42
|
-
|
|
48
|
+
const resolvedSetAsDefault = setAsDefault ?? (await this.resolveSetAsDefault(accountId));
|
|
49
|
+
command.addFlag('default', resolvedSetAsDefault ? 'true' : 'false');
|
|
43
50
|
try {
|
|
44
51
|
const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
|
|
45
|
-
|
|
52
|
+
const structuredContent = parseCommandJsonOutput(stdout, AccountAuthSchema, this.logger, toolName);
|
|
53
|
+
const response = await formatTextContents(stdout, stderr);
|
|
54
|
+
if (structuredContent) {
|
|
55
|
+
response.structuredContent = structuredContent;
|
|
56
|
+
}
|
|
57
|
+
return response;
|
|
46
58
|
}
|
|
47
59
|
catch (error) {
|
|
48
60
|
this.logger.debug(toolName, {
|
|
@@ -52,6 +64,24 @@ export class AuthAccountTool extends Tool {
|
|
|
52
64
|
return formatTextContents(getErrorMessage(error));
|
|
53
65
|
}
|
|
54
66
|
}
|
|
67
|
+
async resolveSetAsDefault(accountId) {
|
|
68
|
+
const currentDefault = getCurrentDefaultAccount();
|
|
69
|
+
if (!currentDefault || currentDefault.accountId === accountId) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
const elicitation = await this.elicit({
|
|
73
|
+
message: `${currentDefault.name} is the default HubSpot account. Set the account you authenticate now as the new default?`,
|
|
74
|
+
fields: {
|
|
75
|
+
setAsDefault: booleanField('Set as default account', `Other CLI commands will use the new account instead of ${currentDefault.name}.`, true),
|
|
76
|
+
},
|
|
77
|
+
required: ['setAsDefault'],
|
|
78
|
+
});
|
|
79
|
+
if (!elicitation) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return (elicitation.action === 'accept' &&
|
|
83
|
+
elicitation.content?.setAsDefault === true);
|
|
84
|
+
}
|
|
55
85
|
register() {
|
|
56
86
|
return this.mcpServer.registerTool(toolName, {
|
|
57
87
|
title: 'Authenticate a HubSpot Account',
|
|
@@ -65,8 +95,9 @@ export class AuthAccountTool extends Tool {
|
|
|
65
95
|
'2. The user clicks "Connect to CLI" in the browser\n' +
|
|
66
96
|
'3. Auth completes automatically via WebSocket\n' +
|
|
67
97
|
'4. Retry any operation that was blocked by missing auth\n\n' +
|
|
68
|
-
'setAsDefault
|
|
98
|
+
'If another account is already the default and setAsDefault is omitted, the tool asks the user whether to replace it. If the client cannot ask the user, the new account becomes the default.',
|
|
69
99
|
inputSchema,
|
|
100
|
+
outputSchema: AccountAuthSchema.shape,
|
|
70
101
|
annotations: {
|
|
71
102
|
readOnlyHint: false,
|
|
72
103
|
destructiveHint: false,
|
|
@@ -7,6 +7,8 @@ import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
8
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
9
9
|
import { PLATFORM_VERSIONS } from '@hubspot/project-parsing-lib/constants';
|
|
10
|
+
import { parseCommandJsonOutput } from '../../utils/json.js';
|
|
11
|
+
import { ProjectCreateSchema } from '../../../lib/jsonOutput/projectCreate.js';
|
|
10
12
|
const inputSchema = {
|
|
11
13
|
absoluteCurrentWorkingDirectory,
|
|
12
14
|
name: z
|
|
@@ -40,6 +42,7 @@ export class CreateProjectTool extends Tool {
|
|
|
40
42
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
41
43
|
const command = new HubSpotCommand('project create', [
|
|
42
44
|
{ name: 'platform-version', value: PLATFORM_VERSIONS.v2026_03 },
|
|
45
|
+
{ name: 'json', value: true },
|
|
43
46
|
]);
|
|
44
47
|
const content = [];
|
|
45
48
|
if (name) {
|
|
@@ -69,20 +72,26 @@ export class CreateProjectTool extends Tool {
|
|
|
69
72
|
if (content.length > 0) {
|
|
70
73
|
return {
|
|
71
74
|
content,
|
|
75
|
+
structuredContent: {},
|
|
72
76
|
};
|
|
73
77
|
}
|
|
74
78
|
// Always pass features, even if it is an empty array to bypass the prompts
|
|
75
79
|
command.addFlag('features', features || []);
|
|
76
80
|
try {
|
|
77
81
|
const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
|
|
78
|
-
|
|
82
|
+
const response = await formatTextContents(stdout, stderr);
|
|
83
|
+
response.structuredContent =
|
|
84
|
+
parseCommandJsonOutput(stdout, ProjectCreateSchema, this.logger, toolName) ?? {};
|
|
85
|
+
return response;
|
|
79
86
|
}
|
|
80
87
|
catch (error) {
|
|
81
88
|
this.logger.debug(toolName, {
|
|
82
89
|
message: 'Handler caught error',
|
|
83
|
-
error:
|
|
90
|
+
error: getErrorMessage(error),
|
|
84
91
|
});
|
|
85
|
-
|
|
92
|
+
const errorResponse = await formatTextContents(getErrorMessage(error));
|
|
93
|
+
errorResponse.isError = true;
|
|
94
|
+
return errorResponse;
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
97
|
register() {
|
|
@@ -90,6 +99,7 @@ export class CreateProjectTool extends Tool {
|
|
|
90
99
|
title: 'Create HubSpot Project',
|
|
91
100
|
description: 'Creates a HubSpot project with the provided name and outputs it in the provided destination',
|
|
92
101
|
inputSchema,
|
|
102
|
+
outputSchema: ProjectCreateSchema.shape,
|
|
93
103
|
annotations: {
|
|
94
104
|
readOnlyHint: false,
|
|
95
105
|
destructiveHint: false,
|
|
@@ -2,12 +2,14 @@ import { z } from 'zod';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { formatTextContents, formatTextContent } from '../../utils/content.js';
|
|
4
4
|
import { HubSpotCommand } from '../../utils/command.js';
|
|
5
|
+
import { parseCommandJsonOutput } from '../../utils/json.js';
|
|
5
6
|
import { ACCOUNT_LEVELS, ACCOUNT_LEVEL_CHOICES, } from '../../../lib/constants.js';
|
|
6
7
|
import { Tool } from '../../Tool.js';
|
|
7
8
|
import { absoluteCurrentWorkingDirectory } from './constants.js';
|
|
8
9
|
import { getConfigAccountByName } from '@hubspot/local-dev-lib/config';
|
|
9
10
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
10
11
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
12
|
+
import { TestAccountCreateSchema } from '../../../lib/jsonOutput/testAccountCreate.js';
|
|
11
13
|
const ACCOUNT_LEVEL_CHOICES_WITHOUT_STARTER = [
|
|
12
14
|
ACCOUNT_LEVELS.FREE,
|
|
13
15
|
ACCOUNT_LEVELS.PROFESSIONAL,
|
|
@@ -71,7 +73,9 @@ export class CreateTestAccountTool extends Tool {
|
|
|
71
73
|
}
|
|
72
74
|
async handler({ absoluteCurrentWorkingDirectory, name, description, marketingLevel, opsLevel, serviceLevel, salesLevel, contentLevel, commerceLevel, configPath, }, extra) {
|
|
73
75
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
74
|
-
const command = new HubSpotCommand('test-account create'
|
|
76
|
+
const command = new HubSpotCommand('test-account create', [
|
|
77
|
+
{ name: 'json', value: true },
|
|
78
|
+
]);
|
|
75
79
|
const content = [];
|
|
76
80
|
// Use config file if provided (LLM should check for config first)
|
|
77
81
|
if (configPath) {
|
|
@@ -89,6 +93,7 @@ export class CreateTestAccountTool extends Tool {
|
|
|
89
93
|
content: [
|
|
90
94
|
formatTextContent(`Failed to read or parse config file at "${configPath}": ${getErrorMessage(error)}. Please ensure the file exists and contains valid JSON.`),
|
|
91
95
|
],
|
|
96
|
+
structuredContent: {},
|
|
92
97
|
};
|
|
93
98
|
}
|
|
94
99
|
if (configJson.accountName) {
|
|
@@ -134,20 +139,14 @@ export class CreateTestAccountTool extends Tool {
|
|
|
134
139
|
if (content.length > 0) {
|
|
135
140
|
return {
|
|
136
141
|
content,
|
|
142
|
+
structuredContent: {},
|
|
137
143
|
};
|
|
138
144
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
catch (error) {
|
|
145
|
-
this.logger.debug(toolName, {
|
|
146
|
-
message: 'Handler caught error',
|
|
147
|
-
error: error instanceof Error ? error.message : String(error),
|
|
148
|
-
});
|
|
149
|
-
return formatTextContents(absoluteCurrentWorkingDirectory, getErrorMessage(error));
|
|
150
|
-
}
|
|
145
|
+
const { stdout, stderr } = await this.runCommand(absoluteCurrentWorkingDirectory, command, extra);
|
|
146
|
+
const response = await formatTextContents(stdout, stderr);
|
|
147
|
+
response.structuredContent =
|
|
148
|
+
parseCommandJsonOutput(stdout, TestAccountCreateSchema, this.logger, toolName) ?? {};
|
|
149
|
+
return response;
|
|
151
150
|
}
|
|
152
151
|
register() {
|
|
153
152
|
return this.mcpServer.registerTool(toolName, {
|
|
@@ -170,6 +169,7 @@ export class CreateTestAccountTool extends Tool {
|
|
|
170
169
|
'Available Hub Tier Levels: FREE, STARTER, PROFESSIONAL, ENTERPRISE\n' +
|
|
171
170
|
'Available Hubs: Marketing (marketingLevel), Sales (salesLevel), Service (serviceLevel), Operations (opsLevel), CMS (contentLevel), Commerce (commerceLevel)',
|
|
172
171
|
inputSchema,
|
|
172
|
+
outputSchema: TestAccountCreateSchema.shape,
|
|
173
173
|
annotations: {
|
|
174
174
|
readOnlyHint: false,
|
|
175
175
|
destructiveHint: false,
|
|
@@ -5,13 +5,13 @@ import { McpLogger } from '../../utils/logger.js';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
7
7
|
absoluteProjectPath: z.ZodString;
|
|
8
|
-
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
9
8
|
buildNumber: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
confirmProductionAccount: z.ZodOptional<z.ZodBoolean>;
|
|
10
10
|
}, z.core.$strip>;
|
|
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,
|
|
14
|
+
handler({ absoluteProjectPath, buildNumber, confirmProductionAccount, }: InputSchemaType, extra?: ToolExtra): Promise<McpToolResponse>;
|
|
15
15
|
register(): RegisteredTool;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { Tool } from '../../Tool.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { HubSpotCommand } from '../../utils/command.js';
|
|
4
|
-
import {
|
|
5
|
-
import { formatTextContents,
|
|
4
|
+
import { absoluteProjectPath, confirmProductionAccount } from './constants.js';
|
|
5
|
+
import { formatErrorTextContents, formatTextContents, } from '../../utils/content.js';
|
|
6
6
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
7
|
+
import { parseCommandJsonOutput } from '../../utils/json.js';
|
|
8
|
+
import { ProjectDeploySchema } from '../../../lib/jsonOutput/projectDeploy.js';
|
|
9
|
+
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
10
|
+
import { discoverAccountTargets } from '../../../lib/accountTargetDiscovery.js';
|
|
11
|
+
import { confirmProductionTargets, setTargetAccount, } from './productionConfirmation.js';
|
|
7
12
|
const inputSchema = {
|
|
8
13
|
absoluteProjectPath,
|
|
9
|
-
absoluteCurrentWorkingDirectory,
|
|
10
14
|
buildNumber: z
|
|
11
15
|
.optional(z.number())
|
|
12
|
-
.describe('The build number to
|
|
16
|
+
.describe('The build number to deploy. This can be found in the project details page using `hs project open`. If omitted, the tool deploys nothing and returns the recent builds, so you can ask the user which one to deploy.'),
|
|
17
|
+
confirmProductionAccount,
|
|
13
18
|
};
|
|
14
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
20
|
const inputSchemaZodObject = z.object({
|
|
@@ -20,31 +25,44 @@ export class DeployProjectTool extends Tool {
|
|
|
20
25
|
constructor(mcpServer, logger) {
|
|
21
26
|
super(mcpServer, logger, toolName);
|
|
22
27
|
}
|
|
23
|
-
async handler({ absoluteProjectPath,
|
|
24
|
-
setupHubSpotConfig(
|
|
25
|
-
const
|
|
28
|
+
async handler({ absoluteProjectPath, buildNumber, confirmProductionAccount, }, extra) {
|
|
29
|
+
setupHubSpotConfig(absoluteProjectPath);
|
|
30
|
+
const { projectDir, projectConfig } = getProjectConfig(absoluteProjectPath);
|
|
31
|
+
const targets = await discoverAccountTargets({ projectDir, projectConfig });
|
|
26
32
|
if (!buildNumber) {
|
|
27
|
-
const
|
|
33
|
+
const listBuildsCommand = new HubSpotCommand('project list-builds', [
|
|
28
34
|
{ name: 'limit', value: 100 },
|
|
29
|
-
])
|
|
30
|
-
|
|
35
|
+
]);
|
|
36
|
+
setTargetAccount(listBuildsCommand, targets);
|
|
37
|
+
const { stdout } = await this.runCommand(absoluteProjectPath, listBuildsCommand, extra);
|
|
38
|
+
return formatErrorTextContents(`Ask the user which build number they would like to deploy? Build information: ${stdout}`);
|
|
31
39
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
const blockedResponse = await confirmProductionTargets(this.mcpServer, this.logger, {
|
|
41
|
+
targets,
|
|
42
|
+
action: `Deploy build #${buildNumber}`,
|
|
43
|
+
toolName,
|
|
44
|
+
confirmedInConversation: confirmProductionAccount,
|
|
45
|
+
});
|
|
46
|
+
if (blockedResponse) {
|
|
47
|
+
return blockedResponse;
|
|
36
48
|
}
|
|
37
49
|
const command = new HubSpotCommand('project deploy', [
|
|
38
50
|
{ name: 'build', value: buildNumber },
|
|
51
|
+
{ name: 'json', value: true },
|
|
39
52
|
]);
|
|
53
|
+
setTargetAccount(command, targets);
|
|
40
54
|
const { stdout, stderr } = await this.runCommand(absoluteProjectPath, command, extra);
|
|
41
|
-
|
|
55
|
+
const response = await formatTextContents(stdout, stderr);
|
|
56
|
+
response.structuredContent =
|
|
57
|
+
parseCommandJsonOutput(stdout, ProjectDeploySchema, this.logger, toolName) ?? {};
|
|
58
|
+
return response;
|
|
42
59
|
}
|
|
43
60
|
register() {
|
|
44
61
|
return this.mcpServer.registerTool(toolName, {
|
|
45
62
|
title: 'Deploy a build of HubSpot Project',
|
|
46
|
-
description: 'Takes a build number and a project name and deploys that build of the project. DO NOT run this tool unless the user specifies they would like to deploy the project. If you do not know the project path, use the find-projects tool first to locate HubSpot projects in the workspace.',
|
|
63
|
+
description: 'Takes a build number and a project name and deploys that build of the project. DO NOT run this tool unless the user specifies they would like to deploy the project. Deploys to production accounts require confirmation from the user. If you do not know the project path, use the find-projects tool first to locate HubSpot projects in the workspace.',
|
|
47
64
|
inputSchema,
|
|
65
|
+
outputSchema: ProjectDeploySchema.shape,
|
|
48
66
|
annotations: {
|
|
49
67
|
readOnlyHint: false,
|
|
50
68
|
destructiveHint: true,
|
|
@@ -48,7 +48,7 @@ export class DocFetchTool extends Tool {
|
|
|
48
48
|
register() {
|
|
49
49
|
return this.mcpServer.registerTool(toolName, {
|
|
50
50
|
title: 'Fetch HubSpot Developer Documentation (single file)',
|
|
51
|
-
description: 'Always use this immediately after `search-docs` and before creating a plan, writing code, or answering technical questions. This tool retrieves the full, authoritative content of a HubSpot Developer Documentation page from its URL, ensuring responses are accurate, up-to-date, and grounded in the official docs.',
|
|
51
|
+
description: 'Always use this immediately after `search-docs` and before creating a plan, writing code, or answering technical questions. This tool retrieves the full, authoritative content of a HubSpot Developer Documentation page from its URL, ensuring responses are accurate, up-to-date, and grounded in the official docs. Some pages include a "Supported products" section (a `<SupportedProducts .../>` tag) listing the products and subscription tiers a feature requires. Read it to tell the user whether a feature is available on their plan, stated plainly (for example "requires Content Hub Enterprise") rather than by quoting raw spec fields.',
|
|
52
52
|
inputSchema,
|
|
53
53
|
annotations: {
|
|
54
54
|
readOnlyHint: true,
|
|
@@ -5,8 +5,10 @@ import { McpToolResponse } from '../../types.js';
|
|
|
5
5
|
import { Tool } from '../../Tool.js';
|
|
6
6
|
declare const inputSchemaZodObject: z.ZodObject<{
|
|
7
7
|
absoluteCurrentWorkingDirectory: z.ZodString;
|
|
8
|
+
account: z.ZodOptional<z.ZodString>;
|
|
8
9
|
docsSearchQuery: z.ZodString;
|
|
9
10
|
docsSearchLimit: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
docsSearchVersion: z.ZodDefault<z.ZodString>;
|
|
10
12
|
}, z.z.core.$strip>;
|
|
11
13
|
export interface DocsSearchResponse {
|
|
12
14
|
results: {
|
|
@@ -15,6 +17,7 @@ export interface DocsSearchResponse {
|
|
|
15
17
|
description: string;
|
|
16
18
|
url: string;
|
|
17
19
|
score: number;
|
|
20
|
+
version?: string;
|
|
18
21
|
}[];
|
|
19
22
|
}
|
|
20
23
|
type InputSchemaType = z.infer<typeof inputSchemaZodObject>;
|
|
@@ -23,7 +26,7 @@ export declare class DocsSearchTool extends Tool<InputSchemaType> {
|
|
|
23
26
|
protected getTrackingMeta({ docsSearchQuery, }: InputSchemaType): {
|
|
24
27
|
[key: string]: string;
|
|
25
28
|
} | undefined;
|
|
26
|
-
handler({ docsSearchQuery, docsSearchLimit, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<McpToolResponse>;
|
|
29
|
+
handler({ docsSearchQuery, docsSearchLimit, docsSearchVersion, account, absoluteCurrentWorkingDirectory, }: InputSchemaType): Promise<McpToolResponse>;
|
|
27
30
|
register(): RegisteredTool;
|
|
28
31
|
}
|
|
29
32
|
export {};
|
|
@@ -2,10 +2,10 @@ import { http } from '@hubspot/local-dev-lib/http';
|
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
import { Tool } from '../../Tool.js';
|
|
4
4
|
import { formatTextContents } from '../../utils/content.js';
|
|
5
|
-
import { absoluteCurrentWorkingDirectory, docsSearchQuery, } from './constants.js';
|
|
5
|
+
import { absoluteCurrentWorkingDirectory, account, docsSearchQuery, } from './constants.js';
|
|
6
6
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
7
7
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
8
|
-
import {
|
|
8
|
+
import { resolveAccountId } from './resolveAccount.js';
|
|
9
9
|
import { getErrorMessage } from '../../../lib/errorHandlers/index.js';
|
|
10
10
|
const docsSearchLimit = z
|
|
11
11
|
.number()
|
|
@@ -14,10 +14,16 @@ const docsSearchLimit = z
|
|
|
14
14
|
.max(20)
|
|
15
15
|
.default(5)
|
|
16
16
|
.describe('Maximum number of results to return.');
|
|
17
|
+
const docsSearchVersion = z
|
|
18
|
+
.string()
|
|
19
|
+
.default('latest')
|
|
20
|
+
.describe('API documentation version to search. Defaults to "latest" for current docs, which is almost always what you want. Only override when the user explicitly asks about a specific or legacy version, using a date-based version like "2026-03" or "legacy". Versionless docs such as guides and CMS pages are always included regardless of this value.');
|
|
17
21
|
const inputSchema = {
|
|
18
22
|
absoluteCurrentWorkingDirectory,
|
|
23
|
+
account,
|
|
19
24
|
docsSearchQuery,
|
|
20
25
|
docsSearchLimit,
|
|
26
|
+
docsSearchVersion,
|
|
21
27
|
};
|
|
22
28
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
29
|
const inputSchemaZodObject = z.object({
|
|
@@ -31,19 +37,22 @@ export class DocsSearchTool extends Tool {
|
|
|
31
37
|
getTrackingMeta({ docsSearchQuery, }) {
|
|
32
38
|
return { mode: docsSearchQuery };
|
|
33
39
|
}
|
|
34
|
-
async handler({ docsSearchQuery, docsSearchLimit, absoluteCurrentWorkingDirectory, }) {
|
|
40
|
+
async handler({ docsSearchQuery, docsSearchLimit, docsSearchVersion, account, absoluteCurrentWorkingDirectory, }) {
|
|
35
41
|
setupHubSpotConfig(absoluteCurrentWorkingDirectory);
|
|
36
42
|
try {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const resolved = await resolveAccountId(this.mcpServer, this.logger, {
|
|
44
|
+
toolName,
|
|
45
|
+
account,
|
|
46
|
+
});
|
|
47
|
+
if ('response' in resolved) {
|
|
48
|
+
return resolved.response;
|
|
42
49
|
}
|
|
50
|
+
const { accountId } = resolved;
|
|
43
51
|
const response = await http.post(accountId, {
|
|
44
52
|
url: 'dev/docs/llms/v1/docs-search',
|
|
45
53
|
data: {
|
|
46
54
|
query: docsSearchQuery,
|
|
55
|
+
version: docsSearchVersion,
|
|
47
56
|
},
|
|
48
57
|
});
|
|
49
58
|
const results = response.data.results;
|
|
@@ -82,7 +91,7 @@ export class DocsSearchTool extends Tool {
|
|
|
82
91
|
register() {
|
|
83
92
|
return this.mcpServer.registerTool(toolName, {
|
|
84
93
|
title: 'Search HubSpot Developer Documentation',
|
|
85
|
-
description: 'Use this first
|
|
94
|
+
description: 'Use this first for any HubSpot developer question, including whether an API or feature is available on a subscription tier or plan (for example "is the content audit API available on Content Hub Professional"). The doc you fetch next states the required product and tier; report it in plain terms (for example "requires Content Hub Enterprise") rather than quoting raw spec fields. This searches the official HubSpot Developer Documentation and returns the most relevant pages, each with a URL for use in `fetch-doc`. Always follow this with a fetch to get the full, authoritative content before making plans or writing answers.',
|
|
86
95
|
inputSchema,
|
|
87
96
|
annotations: {
|
|
88
97
|
readOnlyHint: true,
|