@acquis-consulting/asm 1.0.13 → 1.0.14
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/README.md +31 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/docsFetch.d.ts +25 -0
- package/dist/tools/docsFetch.js +51 -0
- package/dist/tools/docsFetch.js.map +1 -0
- package/dist/tools/docsListCollections.d.ts +44 -0
- package/dist/tools/docsListCollections.js +63 -0
- package/dist/tools/docsListCollections.js.map +1 -0
- package/dist/tools/docsSearch.d.ts +42 -0
- package/dist/tools/docsSearch.js +87 -0
- package/dist/tools/docsSearch.js.map +1 -0
- package/dist/tools/trailheadFetch.d.ts +28 -0
- package/dist/tools/trailheadFetch.js +66 -0
- package/dist/tools/trailheadFetch.js.map +1 -0
- package/dist/tools/trailheadSearch.d.ts +94 -0
- package/dist/tools/trailheadSearch.js +112 -0
- package/dist/tools/trailheadSearch.js.map +1 -0
- package/dist/utils/salesforceDocsClient.d.ts +2 -0
- package/dist/utils/salesforceDocsClient.js +43 -0
- package/dist/utils/salesforceDocsClient.js.map +1 -0
- package/dist/utils/trailheadClient.d.ts +7 -0
- package/dist/utils/trailheadClient.js +35 -0
- package/dist/utils/trailheadClient.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Salesforce MCP Server
|
|
2
|
+
|
|
3
|
+
## Documentation search tools
|
|
4
|
+
|
|
5
|
+
These tools proxy the official Salesforce Labs "Salesforce Docs MCP" server
|
|
6
|
+
(https://labs.agentforce.com/docs/salesforce-docs-mcp) and require no
|
|
7
|
+
Salesforce org connection:
|
|
8
|
+
|
|
9
|
+
- `salesforce_docs_search` — search official Salesforce documentation
|
|
10
|
+
(Apex, LWC, Admin, Architect, MuleSoft, Tableau, Release Notes, and more).
|
|
11
|
+
Returns ranked excerpts with document paths.
|
|
12
|
+
- `salesforce_docs_fetch` — fetch the full content of a documentation page by
|
|
13
|
+
document path (from `salesforce_docs_search`) or URL.
|
|
14
|
+
- `salesforce_docs_list_collections` — list indexed documentation collections
|
|
15
|
+
with document/chunk counts, to discover what to pass as `collection` to
|
|
16
|
+
`salesforce_docs_search`.
|
|
17
|
+
|
|
18
|
+
## Trailhead learning content tools
|
|
19
|
+
|
|
20
|
+
These tools proxy the public Salesforce Trailhead MCP server
|
|
21
|
+
(https://mcp.trailhead.salesforce.com/mcp) and require no Salesforce org
|
|
22
|
+
connection or Trailhead login — content is public and no user progress or
|
|
23
|
+
points are collected:
|
|
24
|
+
|
|
25
|
+
- `salesforce_trailhead_search` — search Trailhead modules, projects, trails,
|
|
26
|
+
trailmixes, superbadges, badges, and Trailhead Journeys by keyword, with
|
|
27
|
+
optional role/level/type filters. Returns an `apiName` you can pass to
|
|
28
|
+
`salesforce_trailhead_fetch`.
|
|
29
|
+
- `salesforce_trailhead_fetch` — fetch the full content (markdown) of a
|
|
30
|
+
Trailhead item by `apiName` (from `salesforce_trailhead_search`). Set
|
|
31
|
+
`expand: true` to include full child-module content when fetching a trail.
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,11 @@ import { userPermissionsDescriptor } from './tools/userPermissions.js';
|
|
|
49
49
|
import { listUserPermissionsDescriptor } from './tools/listUserPermissions.js';
|
|
50
50
|
import { createRecordPageDescriptor } from './tools/createRecordPage.js';
|
|
51
51
|
import { appTabManagementDescriptor } from './tools/appTabManagement.js';
|
|
52
|
+
import { docsSearchDescriptor } from './tools/docsSearch.js';
|
|
53
|
+
import { docsFetchDescriptor } from './tools/docsFetch.js';
|
|
54
|
+
import { docsListCollectionsDescriptor } from './tools/docsListCollections.js';
|
|
55
|
+
import { trailheadSearchDescriptor } from './tools/trailheadSearch.js';
|
|
56
|
+
import { trailheadFetchDescriptor } from './tools/trailheadFetch.js';
|
|
52
57
|
const DIST_DIR = import.meta.filename?.endsWith('.ts')
|
|
53
58
|
? path.join(import.meta.dirname, '..', 'dist')
|
|
54
59
|
: import.meta.dirname;
|
|
@@ -99,6 +104,11 @@ const writeTools = [
|
|
|
99
104
|
const standaloneTools = [
|
|
100
105
|
selectOrgDescriptor,
|
|
101
106
|
salesforceLoginDescriptor,
|
|
107
|
+
docsSearchDescriptor,
|
|
108
|
+
docsFetchDescriptor,
|
|
109
|
+
docsListCollectionsDescriptor,
|
|
110
|
+
trailheadSearchDescriptor,
|
|
111
|
+
trailheadFetchDescriptor,
|
|
102
112
|
];
|
|
103
113
|
const SESSION_ID_SCHEMA = z
|
|
104
114
|
.string()
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BA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AC5E,MAAM;AACN,MAAM;AAEN,gEAAgE;AAChE,sCAAsC;AACtC,kBAAkB;AAClB,0FAA0F;AAC1F,eAAe;AACf,wFAAwF;AACxF,SAAS;AACT,OAAO;AACP,KAAK;AAEL,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC1D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const docsFetchTool: Tool;
|
|
4
|
+
export interface DocsFetchArgs {
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function handleDocsFetch(args: DocsFetchArgs): Promise<{
|
|
8
|
+
content: {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
isError: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const docsFetchSchema: {
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
};
|
|
17
|
+
export declare const docsFetchDescriptor: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string | undefined;
|
|
20
|
+
schema: {
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
};
|
|
23
|
+
handler: typeof handleDocsFetch;
|
|
24
|
+
noConnection: boolean;
|
|
25
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { callDocsMcpTool } from '../utils/salesforceDocsClient.js';
|
|
3
|
+
import { toolResponse } from '../utils/errors.js';
|
|
4
|
+
export const docsFetchTool = {
|
|
5
|
+
name: 'salesforce_docs_fetch',
|
|
6
|
+
description: 'Fetch the full content of an official Salesforce documentation page via the official Salesforce Labs Docs MCP server. ' +
|
|
7
|
+
'Pass a document path returned by salesforce_docs_search, or a full Salesforce documentation URL.',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
id: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'Document path from salesforce_docs_search results (e.g. "lwc/lwc/guides/create/create-lifecycle-hooks.html") or a full Salesforce doc URL.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
required: ['id'],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export async function handleDocsFetch(args) {
|
|
20
|
+
try {
|
|
21
|
+
const structured = await callDocsMcpTool('salesforce_docs_fetch', { id: args.id });
|
|
22
|
+
const content = structured.content;
|
|
23
|
+
if (!content) {
|
|
24
|
+
return toolResponse(`No content returned for document "${args.id}".`, true);
|
|
25
|
+
}
|
|
26
|
+
const title = structured.metadata?.title ?? args.id;
|
|
27
|
+
const collection = structured.collection ?? 'unknown';
|
|
28
|
+
const url = structured.url;
|
|
29
|
+
const header = [
|
|
30
|
+
`# ${title}`,
|
|
31
|
+
`Collection: ${collection}`,
|
|
32
|
+
url ? `URL: ${url}` : null,
|
|
33
|
+
'',
|
|
34
|
+
].filter(Boolean).join('\n');
|
|
35
|
+
return toolResponse(`${header}\n${content}`);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return toolResponse(`salesforce_docs_fetch failed: ${error.message}`, true);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export const docsFetchSchema = {
|
|
42
|
+
id: z.string().describe('Document path from salesforce_docs_search results (e.g. "lwc/lwc/guides/create/create-lifecycle-hooks.html") or a full Salesforce doc URL.'),
|
|
43
|
+
};
|
|
44
|
+
export const docsFetchDescriptor = {
|
|
45
|
+
name: 'salesforce_docs_fetch',
|
|
46
|
+
description: docsFetchTool.description,
|
|
47
|
+
schema: docsFetchSchema,
|
|
48
|
+
handler: handleDocsFetch,
|
|
49
|
+
noConnection: true,
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=docsFetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsFetch.js","sourceRoot":"","sources":["../../src/tools/docsFetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACT,wHAAwH;QACxH,kGAAkG;IACpG,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE;gBACF,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4IAA4I;aAC1J;SACF;QACD,QAAQ,EAAE,CAAC,IAAI,CAAC;KACjB;CACF,CAAC;AAMF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAmB;IACvD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,uBAAuB,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACnF,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAEnC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,YAAY,CAAC,qCAAqC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9E,CAAC;QAED,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,SAAS,CAAC;QACtD,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;QAE3B,MAAM,MAAM,GAAG;YACb,KAAK,KAAK,EAAE;YACZ,eAAe,UAAU,EAAE;YAC3B,GAAG,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI;YAC1B,EAAE;SACH,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,OAAO,YAAY,CAAC,GAAG,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,YAAY,CAAC,iCAAiC,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4IAA4I,CAAC;CACtK,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,aAAa,CAAC,WAAW;IACtC,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
declare const SOURCES: readonly ["admin", "architect", "developer", "legacydeveloper", "mulesoft", "tableau"];
|
|
4
|
+
export declare const docsListCollectionsTool: Tool;
|
|
5
|
+
export interface DocsListCollectionsArgs {
|
|
6
|
+
source?: typeof SOURCES[number];
|
|
7
|
+
filter?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function handleDocsListCollections(args: DocsListCollectionsArgs): Promise<{
|
|
10
|
+
content: {
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
}[];
|
|
14
|
+
isError: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const docsListCollectionsSchema: {
|
|
17
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
admin: "admin";
|
|
19
|
+
architect: "architect";
|
|
20
|
+
developer: "developer";
|
|
21
|
+
legacydeveloper: "legacydeveloper";
|
|
22
|
+
mulesoft: "mulesoft";
|
|
23
|
+
tableau: "tableau";
|
|
24
|
+
}>>;
|
|
25
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
26
|
+
};
|
|
27
|
+
export declare const docsListCollectionsDescriptor: {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string | undefined;
|
|
30
|
+
schema: {
|
|
31
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
32
|
+
admin: "admin";
|
|
33
|
+
architect: "architect";
|
|
34
|
+
developer: "developer";
|
|
35
|
+
legacydeveloper: "legacydeveloper";
|
|
36
|
+
mulesoft: "mulesoft";
|
|
37
|
+
tableau: "tableau";
|
|
38
|
+
}>>;
|
|
39
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
40
|
+
};
|
|
41
|
+
handler: typeof handleDocsListCollections;
|
|
42
|
+
noConnection: boolean;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { readDocsMcpResource } from '../utils/salesforceDocsClient.js';
|
|
3
|
+
import { toolResponse } from '../utils/errors.js';
|
|
4
|
+
const SOURCES = ['admin', 'architect', 'developer', 'legacydeveloper', 'mulesoft', 'tableau'];
|
|
5
|
+
export const docsListCollectionsTool = {
|
|
6
|
+
name: 'salesforce_docs_list_collections',
|
|
7
|
+
description: 'List indexed Salesforce documentation collections (with document/chunk counts and last-indexed timestamps) from the ' +
|
|
8
|
+
'official Salesforce Labs Docs MCP server. Useful for discovering which collection to pass to salesforce_docs_search.',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
source: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
enum: [...SOURCES],
|
|
15
|
+
description: 'Filter collections by root source.',
|
|
16
|
+
},
|
|
17
|
+
filter: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Filter collection names by substring (case-insensitive).',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
required: [],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export async function handleDocsListCollections(args) {
|
|
26
|
+
try {
|
|
27
|
+
const data = await readDocsMcpResource('collection://list');
|
|
28
|
+
let collections = data.collections ?? [];
|
|
29
|
+
if (args.source) {
|
|
30
|
+
collections = collections.filter((c) => String(c.collection ?? '').startsWith(args.source + '/'));
|
|
31
|
+
}
|
|
32
|
+
if (args.filter) {
|
|
33
|
+
const pattern = args.filter.toLowerCase();
|
|
34
|
+
collections = collections.filter((c) => String(c.collection ?? '').toLowerCase().includes(pattern));
|
|
35
|
+
}
|
|
36
|
+
if (collections.length === 0) {
|
|
37
|
+
return toolResponse('No collections found matching the given filters.');
|
|
38
|
+
}
|
|
39
|
+
collections.sort((a, b) => String(a.collection ?? '').localeCompare(String(b.collection ?? '')));
|
|
40
|
+
const lines = collections.map((c) => {
|
|
41
|
+
const docs = Number(c.document_count ?? 0).toLocaleString();
|
|
42
|
+
const chunks = Number(c.chunk_count ?? 0).toLocaleString();
|
|
43
|
+
const lastIndexed = c.last_indexed ?? 'unknown';
|
|
44
|
+
return `- ${c.collection}: ${docs} docs, ${chunks} chunks, last indexed ${lastIndexed}`;
|
|
45
|
+
});
|
|
46
|
+
return toolResponse(`Found ${collections.length} collection(s):\n\n${lines.join('\n')}`);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return toolResponse(`salesforce_docs_list_collections failed: ${error.message}`, true);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export const docsListCollectionsSchema = {
|
|
53
|
+
source: z.enum(SOURCES).describe('Filter collections by root source.').optional(),
|
|
54
|
+
filter: z.string().describe('Filter collection names by substring (case-insensitive).').optional(),
|
|
55
|
+
};
|
|
56
|
+
export const docsListCollectionsDescriptor = {
|
|
57
|
+
name: 'salesforce_docs_list_collections',
|
|
58
|
+
description: docsListCollectionsTool.description,
|
|
59
|
+
schema: docsListCollectionsSchema,
|
|
60
|
+
handler: handleDocsListCollections,
|
|
61
|
+
noConnection: true,
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=docsListCollections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsListCollections.js","sourceRoot":"","sources":["../../src/tools/docsListCollections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AAEvG,MAAM,CAAC,MAAM,uBAAuB,GAAS;IAC3C,IAAI,EAAE,kCAAkC;IACxC,WAAW,EACT,sHAAsH;QACtH,sHAAsH;IACxH,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;gBAClB,WAAW,EAAE,oCAAoC;aAClD;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0DAA0D;aACxE;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAOF,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,IAA6B;IAC3E,IAAI,CAAC;QACH,MAAM,IAAI,GAA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AC3D,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,IAAI,SAAS,CAAC;YAChD,OAAO,KAAK,CAAC,CAAC,UAAU,KAAK,IAAI,UAAU,MAAM,yBAAyB,WAAW,EAAE,CAAC;QAC1F,CAAC,CAAC,CAAC;QAEH,OAAO,YAAY,CAAC,SAAS,WAAW,CAAC,MAAM,sBAAsB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,YAAY,CAAC,4CAA4C,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAC,QAAQ,EAAE;IACjF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC,CAAC,QAAQ,EAAE;CACnG,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,uBAAuB,CAAC,WAAW;IAChD,MAAM,EAAE,yBAAyB;IACjC,OAAO,EAAE,yBAAyB;IAClC,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const docsSearchTool: Tool;
|
|
4
|
+
export interface DocsSearchArgs {
|
|
5
|
+
query: string;
|
|
6
|
+
collection?: string;
|
|
7
|
+
limit?: number;
|
|
8
|
+
mode?: 'auto' | 'semantic' | 'hybrid';
|
|
9
|
+
}
|
|
10
|
+
export declare function handleDocsSearch(args: DocsSearchArgs): Promise<{
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
isError: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const docsSearchSchema: {
|
|
18
|
+
query: z.ZodString;
|
|
19
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
20
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
auto: "auto";
|
|
23
|
+
semantic: "semantic";
|
|
24
|
+
hybrid: "hybrid";
|
|
25
|
+
}>>;
|
|
26
|
+
};
|
|
27
|
+
export declare const docsSearchDescriptor: {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string | undefined;
|
|
30
|
+
schema: {
|
|
31
|
+
query: z.ZodString;
|
|
32
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
33
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
auto: "auto";
|
|
36
|
+
semantic: "semantic";
|
|
37
|
+
hybrid: "hybrid";
|
|
38
|
+
}>>;
|
|
39
|
+
};
|
|
40
|
+
handler: typeof handleDocsSearch;
|
|
41
|
+
noConnection: boolean;
|
|
42
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { callDocsMcpTool } from '../utils/salesforceDocsClient.js';
|
|
3
|
+
import { toolResponse } from '../utils/errors.js';
|
|
4
|
+
export const docsSearchTool = {
|
|
5
|
+
name: 'salesforce_docs_search',
|
|
6
|
+
description: 'Search official Salesforce documentation (Apex, LWC, Admin, Architect, MuleSoft, Tableau, Release Notes, and more) ' +
|
|
7
|
+
'via the official Salesforce Labs Docs MCP server. Returns ranked excerpts with document paths you can pass to ' +
|
|
8
|
+
'salesforce_docs_fetch for the full document. Use this proactively whenever a request touches a Salesforce feature, ' +
|
|
9
|
+
'object, or API you are not fully certain about — especially niche or less-common modules (CPQ, MuleSoft, Platform ' +
|
|
10
|
+
'Events, Data Cloud, Tableau, Field Service, Experience Cloud, Industries/OmniStudio, etc.) — rather than relying on ' +
|
|
11
|
+
'possibly outdated training knowledge.',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
query: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Search query or question, e.g. "how to configure einstein copilot" or an error code like "INVALID_FIELD_FOR_INSERT_UPDATE".',
|
|
18
|
+
},
|
|
19
|
+
collection: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Optional collection to restrict the search to, e.g. "developer/lwc".',
|
|
22
|
+
},
|
|
23
|
+
limit: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
description: 'Max number of results to return (1-50). Default 5.',
|
|
26
|
+
},
|
|
27
|
+
mode: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
enum: ['auto', 'semantic', 'hybrid'],
|
|
30
|
+
description: 'Search mode. Use "hybrid" for literal matches on error codes, permission names, or camelCase/snake_case identifiers. Default "auto".',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ['query'],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export async function handleDocsSearch(args) {
|
|
37
|
+
try {
|
|
38
|
+
const params = {
|
|
39
|
+
query: args.query,
|
|
40
|
+
limit: args.limit ?? 5,
|
|
41
|
+
search_mode: args.mode ?? 'auto',
|
|
42
|
+
};
|
|
43
|
+
if (args.collection)
|
|
44
|
+
params.collection = args.collection;
|
|
45
|
+
const structured = await callDocsMcpTool('salesforce_docs_search', params);
|
|
46
|
+
const chunks = structured.chunks ?? [];
|
|
47
|
+
const total = structured.total ?? chunks.length;
|
|
48
|
+
const metrics = structured.metrics ?? {};
|
|
49
|
+
if (chunks.length === 0) {
|
|
50
|
+
return toolResponse(`No documentation matches found for "${args.query}".`);
|
|
51
|
+
}
|
|
52
|
+
const lines = [
|
|
53
|
+
`Found ${total} match(es), showing top ${chunks.length} (mode: ${metrics.searchMode ?? params.search_mode}):`,
|
|
54
|
+
'',
|
|
55
|
+
];
|
|
56
|
+
for (const chunk of chunks) {
|
|
57
|
+
const title = chunk.metadata?.title ?? chunk.documentPath;
|
|
58
|
+
lines.push(`### ${title} (score: ${(chunk.score ?? 0).toFixed(4)})`);
|
|
59
|
+
lines.push(`- Collection: ${chunk.collection ?? 'unknown'}`);
|
|
60
|
+
lines.push(`- Document path (pass to salesforce_docs_fetch): ${chunk.documentPath}`);
|
|
61
|
+
if (chunk.url)
|
|
62
|
+
lines.push(`- URL: ${chunk.url}`);
|
|
63
|
+
if (chunk.content) {
|
|
64
|
+
lines.push(`- Excerpt: ${String(chunk.content).trim().slice(0, 500)}`);
|
|
65
|
+
}
|
|
66
|
+
lines.push('');
|
|
67
|
+
}
|
|
68
|
+
return toolResponse(lines.join('\n').trimEnd());
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return toolResponse(`salesforce_docs_search failed: ${error.message}`, true);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export const docsSearchSchema = {
|
|
75
|
+
query: z.string().describe('Search query or question, e.g. "how to configure einstein copilot" or an error code like "INVALID_FIELD_FOR_INSERT_UPDATE".'),
|
|
76
|
+
collection: z.string().describe('Optional collection to restrict the search to, e.g. "developer/lwc".').optional(),
|
|
77
|
+
limit: z.number().describe('Max number of results to return (1-50). Default 5.').optional(),
|
|
78
|
+
mode: z.enum(['auto', 'semantic', 'hybrid']).describe('Search mode. Use "hybrid" for literal matches on error codes, permission names, or camelCase/snake_case identifiers. Default "auto".').optional(),
|
|
79
|
+
};
|
|
80
|
+
export const docsSearchDescriptor = {
|
|
81
|
+
name: 'salesforce_docs_search',
|
|
82
|
+
description: docsSearchTool.description,
|
|
83
|
+
schema: docsSearchSchema,
|
|
84
|
+
handler: handleDocsSearch,
|
|
85
|
+
noConnection: true,
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=docsSearch.js.map
|
|
@@ -0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,GAAG,CAAC,EAAE,CAAC,CAAC;YACzE,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,YAAY,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6HAA6H,CAAC;IACzJ,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC,CAAC,QAAQ,EAAE;IAClH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC,CAAC,QAAQ,EAAE;IAC3F,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,sIAAsI,CAAC,CAAC,QAAQ,EAAE;CACzM,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,cAAc,CAAC,WAAW;IACvC,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,gBAAgB;IACzB,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const trailheadFetchTool: Tool;
|
|
4
|
+
export interface TrailheadFetchArgs {
|
|
5
|
+
apiName: string;
|
|
6
|
+
expand?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function handleTrailheadFetch(args: TrailheadFetchArgs): Promise<{
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
isError: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const trailheadFetchSchema: {
|
|
16
|
+
apiName: z.ZodString;
|
|
17
|
+
expand: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
};
|
|
19
|
+
export declare const trailheadFetchDescriptor: {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string | undefined;
|
|
22
|
+
schema: {
|
|
23
|
+
apiName: z.ZodString;
|
|
24
|
+
expand: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
};
|
|
26
|
+
handler: typeof handleTrailheadFetch;
|
|
27
|
+
noConnection: boolean;
|
|
28
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { callTrailheadMcpTool } from '../utils/trailheadClient.js';
|
|
3
|
+
import { toolResponse } from '../utils/errors.js';
|
|
4
|
+
export const trailheadFetchTool = {
|
|
5
|
+
name: 'salesforce_trailhead_fetch',
|
|
6
|
+
description: 'Fetch the full content of a Salesforce Trailhead module, project, trail, trailmix, superbadge, or badge via ' +
|
|
7
|
+
'the public Trailhead MCP server. Pass the apiName returned by salesforce_trailhead_search.',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
apiName: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'The apiName (slug) of the content to fetch, from salesforce_trailhead_search results, e.g. "quickstart-apex".',
|
|
14
|
+
},
|
|
15
|
+
expand: {
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
description: 'Expand a trail to include full child-module content. Can produce a very large response. Default false.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: ['apiName'],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export async function handleTrailheadFetch(args) {
|
|
24
|
+
try {
|
|
25
|
+
const params = { apiName: args.apiName };
|
|
26
|
+
if (args.expand !== undefined)
|
|
27
|
+
params.expand = args.expand;
|
|
28
|
+
const { structuredContent, content } = await callTrailheadMcpTool('fetch_content', params);
|
|
29
|
+
const title = structuredContent?.title ?? args.apiName;
|
|
30
|
+
const type = structuredContent?.type;
|
|
31
|
+
const url = structuredContent?.url;
|
|
32
|
+
const pointTotal = structuredContent?.pointTotal;
|
|
33
|
+
const minuteTotal = structuredContent?.minuteTotal;
|
|
34
|
+
const header = [
|
|
35
|
+
`# ${title}`,
|
|
36
|
+
type ? `Type: ${type}` : null,
|
|
37
|
+
url ? `URL: ${url}` : null,
|
|
38
|
+
pointTotal || minuteTotal ? `Points: ${pointTotal ?? '?'} | Minutes: ${minuteTotal ?? '?'}` : null,
|
|
39
|
+
'',
|
|
40
|
+
].filter(Boolean).join('\n');
|
|
41
|
+
const markdown = structuredContent?.markdown;
|
|
42
|
+
if (markdown) {
|
|
43
|
+
return toolResponse(`${header}\n${markdown}`);
|
|
44
|
+
}
|
|
45
|
+
const rawText = (content ?? []).map((c) => c.text).filter(Boolean).join('\n');
|
|
46
|
+
if (rawText) {
|
|
47
|
+
return toolResponse(`${header}\n${rawText}`);
|
|
48
|
+
}
|
|
49
|
+
return toolResponse(`No content returned for "${args.apiName}".`, true);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return toolResponse(`salesforce_trailhead_fetch failed: ${error.message}`, true);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export const trailheadFetchSchema = {
|
|
56
|
+
apiName: z.string().describe('The apiName (slug) of the content to fetch, from salesforce_trailhead_search results, e.g. "quickstart-apex".'),
|
|
57
|
+
expand: z.boolean().describe('Expand a trail to include full child-module content. Can produce a very large response. Default false.').optional(),
|
|
58
|
+
};
|
|
59
|
+
export const trailheadFetchDescriptor = {
|
|
60
|
+
name: 'salesforce_trailhead_fetch',
|
|
61
|
+
description: trailheadFetchTool.description,
|
|
62
|
+
schema: trailheadFetchSchema,
|
|
63
|
+
handler: handleTrailheadFetch,
|
|
64
|
+
noConnection: true,
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=trailheadFetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailheadFetch.js","sourceRoot":"","sources":["../../src/tools/trailheadFetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,4BAA4B;IAClC,WAAW,EACT,8GAA8G;QAC9G,4FAA4F;IAC9F,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+GAA+G;aAC7H;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,wGAAwG;aACtH;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;CACF,CAAC;AAOF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAwB;IACjE,IAAI,CAAC;QACH,MAAM,MAAM,GAAwB,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE3D,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,MAAM,oBAAoB,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAE3F,MAAM,KAAK,GAAG,iBAAiB,EAAE,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC;QACvD,MAAM,IAAI,GAAG,iBAAiB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C,CAAC;IACnF,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+GAA+G,CAAC;IAC7I,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,wGAAwG,CAAC,CAAC,QAAQ,EAAE;CAClJ,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,kBAAkB,CAAC,WAAW;IAC3C,MAAM,EAAE,oBAAoB;IAC5B,OAAO,EAAE,oBAAoB;IAC7B,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
declare const ROLES: readonly ["Administrator", "Architect", "Business Analyst", "Consultant", "Customer Service Professional", "Cybersecurity", "Data Analyst", "Designer", "Developer", "End User", "Marketer", "Sales Professional"];
|
|
4
|
+
declare const LEVELS: readonly ["Foundational", "Intermediate", "Advanced"];
|
|
5
|
+
declare const CONTENT_TYPES: readonly ["MODULE", "PROJECT", "TRAIL", "TRAILMIX", "SUPERBADGE", "BADGE", "TRAILHEAD_JOURNEY"];
|
|
6
|
+
export declare const trailheadSearchTool: Tool;
|
|
7
|
+
export interface TrailheadSearchArgs {
|
|
8
|
+
query: string;
|
|
9
|
+
first?: number;
|
|
10
|
+
roles?: Array<typeof ROLES[number]>;
|
|
11
|
+
levels?: Array<typeof LEVELS[number]>;
|
|
12
|
+
types?: Array<typeof CONTENT_TYPES[number]>;
|
|
13
|
+
locale?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function handleTrailheadSearch(args: TrailheadSearchArgs): Promise<{
|
|
16
|
+
content: {
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}[];
|
|
20
|
+
isError: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const trailheadSearchSchema: {
|
|
23
|
+
query: z.ZodString;
|
|
24
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
26
|
+
Administrator: "Administrator";
|
|
27
|
+
Architect: "Architect";
|
|
28
|
+
"Business Analyst": "Business Analyst";
|
|
29
|
+
Consultant: "Consultant";
|
|
30
|
+
"Customer Service Professional": "Customer Service Professional";
|
|
31
|
+
Cybersecurity: "Cybersecurity";
|
|
32
|
+
"Data Analyst": "Data Analyst";
|
|
33
|
+
Designer: "Designer";
|
|
34
|
+
Developer: "Developer";
|
|
35
|
+
"End User": "End User";
|
|
36
|
+
Marketer: "Marketer";
|
|
37
|
+
"Sales Professional": "Sales Professional";
|
|
38
|
+
}>>>;
|
|
39
|
+
levels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
40
|
+
Foundational: "Foundational";
|
|
41
|
+
Intermediate: "Intermediate";
|
|
42
|
+
Advanced: "Advanced";
|
|
43
|
+
}>>>;
|
|
44
|
+
types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
45
|
+
MODULE: "MODULE";
|
|
46
|
+
PROJECT: "PROJECT";
|
|
47
|
+
TRAIL: "TRAIL";
|
|
48
|
+
TRAILMIX: "TRAILMIX";
|
|
49
|
+
SUPERBADGE: "SUPERBADGE";
|
|
50
|
+
BADGE: "BADGE";
|
|
51
|
+
TRAILHEAD_JOURNEY: "TRAILHEAD_JOURNEY";
|
|
52
|
+
}>>>;
|
|
53
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
54
|
+
};
|
|
55
|
+
export declare const trailheadSearchDescriptor: {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string | undefined;
|
|
58
|
+
schema: {
|
|
59
|
+
query: z.ZodString;
|
|
60
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
62
|
+
Administrator: "Administrator";
|
|
63
|
+
Architect: "Architect";
|
|
64
|
+
"Business Analyst": "Business Analyst";
|
|
65
|
+
Consultant: "Consultant";
|
|
66
|
+
"Customer Service Professional": "Customer Service Professional";
|
|
67
|
+
Cybersecurity: "Cybersecurity";
|
|
68
|
+
"Data Analyst": "Data Analyst";
|
|
69
|
+
Designer: "Designer";
|
|
70
|
+
Developer: "Developer";
|
|
71
|
+
"End User": "End User";
|
|
72
|
+
Marketer: "Marketer";
|
|
73
|
+
"Sales Professional": "Sales Professional";
|
|
74
|
+
}>>>;
|
|
75
|
+
levels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
76
|
+
Foundational: "Foundational";
|
|
77
|
+
Intermediate: "Intermediate";
|
|
78
|
+
Advanced: "Advanced";
|
|
79
|
+
}>>>;
|
|
80
|
+
types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
81
|
+
MODULE: "MODULE";
|
|
82
|
+
PROJECT: "PROJECT";
|
|
83
|
+
TRAIL: "TRAIL";
|
|
84
|
+
TRAILMIX: "TRAILMIX";
|
|
85
|
+
SUPERBADGE: "SUPERBADGE";
|
|
86
|
+
BADGE: "BADGE";
|
|
87
|
+
TRAILHEAD_JOURNEY: "TRAILHEAD_JOURNEY";
|
|
88
|
+
}>>>;
|
|
89
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
90
|
+
};
|
|
91
|
+
handler: typeof handleTrailheadSearch;
|
|
92
|
+
noConnection: boolean;
|
|
93
|
+
};
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { callTrailheadMcpTool } from '../utils/trailheadClient.js';
|
|
3
|
+
import { toolResponse } from '../utils/errors.js';
|
|
4
|
+
const ROLES = [
|
|
5
|
+
'Administrator', 'Architect', 'Business Analyst', 'Consultant',
|
|
6
|
+
'Customer Service Professional', 'Cybersecurity', 'Data Analyst',
|
|
7
|
+
'Designer', 'Developer', 'End User', 'Marketer', 'Sales Professional',
|
|
8
|
+
];
|
|
9
|
+
const LEVELS = ['Foundational', 'Intermediate', 'Advanced'];
|
|
10
|
+
const CONTENT_TYPES = ['MODULE', 'PROJECT', 'TRAIL', 'TRAILMIX', 'SUPERBADGE', 'BADGE', 'TRAILHEAD_JOURNEY'];
|
|
11
|
+
export const trailheadSearchTool = {
|
|
12
|
+
name: 'salesforce_trailhead_search',
|
|
13
|
+
description: 'Search official Salesforce Trailhead learning content (modules, projects, trails, trailmixes, superbadges, ' +
|
|
14
|
+
'badges, and Trailhead Journeys) via the public Trailhead MCP server. Returns matching items with an apiName ' +
|
|
15
|
+
'you can pass to salesforce_trailhead_fetch for the full content. No Salesforce org connection or Trailhead ' +
|
|
16
|
+
'login is required — content is public and no user progress or points are collected. Use this when a user asks ' +
|
|
17
|
+
'for Trailhead recommendations, learning paths, certification/superbadge prep, or "is there a Trailhead module ' +
|
|
18
|
+
'for X".',
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
query: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Search query terms, e.g. "Agentforce" or "Apex Triggers".',
|
|
25
|
+
},
|
|
26
|
+
first: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
description: 'Number of results to return (1-12). Default 6.',
|
|
29
|
+
},
|
|
30
|
+
roles: {
|
|
31
|
+
type: 'array',
|
|
32
|
+
items: { type: 'string', enum: [...ROLES] },
|
|
33
|
+
description: 'Optional filter by role(s).',
|
|
34
|
+
},
|
|
35
|
+
levels: {
|
|
36
|
+
type: 'array',
|
|
37
|
+
items: { type: 'string', enum: [...LEVELS] },
|
|
38
|
+
description: 'Optional filter by difficulty level(s).',
|
|
39
|
+
},
|
|
40
|
+
types: {
|
|
41
|
+
type: 'array',
|
|
42
|
+
items: { type: 'string', enum: [...CONTENT_TYPES] },
|
|
43
|
+
description: 'Optional filter by content type(s).',
|
|
44
|
+
},
|
|
45
|
+
locale: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Query locale context, e.g. "en-US", "de-DE", "ja-JP". Default "en-US".',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: ['query'],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export async function handleTrailheadSearch(args) {
|
|
54
|
+
try {
|
|
55
|
+
const params = {
|
|
56
|
+
query: args.query,
|
|
57
|
+
first: args.first ?? 6,
|
|
58
|
+
};
|
|
59
|
+
if (args.roles?.length)
|
|
60
|
+
params.roles = args.roles;
|
|
61
|
+
if (args.levels?.length)
|
|
62
|
+
params.levels = args.levels;
|
|
63
|
+
if (args.types?.length)
|
|
64
|
+
params.types = args.types;
|
|
65
|
+
if (args.locale)
|
|
66
|
+
params.locale = args.locale;
|
|
67
|
+
const { structuredContent, content } = await callTrailheadMcpTool('content_search', params);
|
|
68
|
+
const results = structuredContent?.results;
|
|
69
|
+
if (Array.isArray(results) && results.length > 0) {
|
|
70
|
+
const lines = [`Found ${results.length} match(es) for "${args.query}":`, ''];
|
|
71
|
+
for (const item of results) {
|
|
72
|
+
const type = item.type ?? 'UNKNOWN';
|
|
73
|
+
const title = item.title ?? 'No Title';
|
|
74
|
+
lines.push(`### ${title} (${type})`);
|
|
75
|
+
lines.push(`- apiName (pass to salesforce_trailhead_fetch): ${item.apiName ?? 'unknown'}`);
|
|
76
|
+
if (item.pointTotal || item.minuteTotal) {
|
|
77
|
+
lines.push(`- Points: ${item.pointTotal ?? '?'} | Minutes: ${item.minuteTotal ?? '?'}`);
|
|
78
|
+
}
|
|
79
|
+
if (item.url)
|
|
80
|
+
lines.push(`- URL: ${item.url}`);
|
|
81
|
+
if (item.description)
|
|
82
|
+
lines.push(`- ${String(item.description).trim().slice(0, 500)}`);
|
|
83
|
+
lines.push('');
|
|
84
|
+
}
|
|
85
|
+
return toolResponse(lines.join('\n').trimEnd());
|
|
86
|
+
}
|
|
87
|
+
const rawText = (content ?? []).map((c) => c.text).filter(Boolean).join('\n');
|
|
88
|
+
if (rawText) {
|
|
89
|
+
return toolResponse(`(raw response, no structured results)\n\n${rawText}`);
|
|
90
|
+
}
|
|
91
|
+
return toolResponse(`No Trailhead content matches found for "${args.query}".`);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return toolResponse(`salesforce_trailhead_search failed: ${error.message}`, true);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export const trailheadSearchSchema = {
|
|
98
|
+
query: z.string().describe('Search query terms, e.g. "Agentforce" or "Apex Triggers".'),
|
|
99
|
+
first: z.number().describe('Number of results to return (1-12). Default 6.').optional(),
|
|
100
|
+
roles: z.array(z.enum(ROLES)).describe('Optional filter by role(s).').optional(),
|
|
101
|
+
levels: z.array(z.enum(LEVELS)).describe('Optional filter by difficulty level(s).').optional(),
|
|
102
|
+
types: z.array(z.enum(CONTENT_TYPES)).describe('Optional filter by content type(s).').optional(),
|
|
103
|
+
locale: z.string().describe('Query locale context, e.g. "en-US", "de-DE", "ja-JP". Default "en-US".').optional(),
|
|
104
|
+
};
|
|
105
|
+
export const trailheadSearchDescriptor = {
|
|
106
|
+
name: 'salesforce_trailhead_search',
|
|
107
|
+
description: trailheadSearchTool.description,
|
|
108
|
+
schema: trailheadSearchSchema,
|
|
109
|
+
handler: handleTrailheadSearch,
|
|
110
|
+
noConnection: true,
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=trailheadSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailheadSearch.js","sourceRoot":"","sources":["../../src/tools/trailheadSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,KAAK,GAAG;IACZ,eAAe,EAAE,WAAW,EAAE,k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C,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IACvF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC,CAAC,QAAQ,EAAE;IACvF,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC,QAAQ,EAAE;IAChF,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC,QAAQ,EAAE;IAC9F,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC,QAAQ,EAAE;IAChG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wEAAwE,CAAC,CAAC,QAAQ,EAAE;CACjH,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,mBAAmB,CAAC,WAAW;IAC5C,MAAM,EAAE,qBAAqB;IAC7B,OAAO,EAAE,qBAAqB;IAC9B,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Official Salesforce Labs "Salesforce Docs MCP" server — see https://labs.agentforce.com/docs/salesforce-docs-mcp
|
|
2
|
+
const DOCS_MCP_ENDPOINT = 'https://salesforce-docs-76258744c9d7.herokuapp.com/api/mcp';
|
|
3
|
+
async function callJsonRpc(method, params) {
|
|
4
|
+
const response = await fetch(DOCS_MCP_ENDPOINT, {
|
|
5
|
+
method: 'POST',
|
|
6
|
+
headers: {
|
|
7
|
+
'Content-Type': 'application/json',
|
|
8
|
+
Accept: 'application/json, text/event-stream',
|
|
9
|
+
},
|
|
10
|
+
body: JSON.stringify({ jsonrpc: '2.0', method, params, id: 1 }),
|
|
11
|
+
});
|
|
12
|
+
const text = await response.text();
|
|
13
|
+
let json;
|
|
14
|
+
try {
|
|
15
|
+
json = JSON.parse(text);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
throw new Error(`Salesforce Docs MCP returned a non-JSON response (HTTP ${response.status}): ${text.slice(0, 500)}`);
|
|
19
|
+
}
|
|
20
|
+
if (!response.ok && !json.error) {
|
|
21
|
+
throw new Error(`Salesforce Docs MCP request failed (HTTP ${response.status})`);
|
|
22
|
+
}
|
|
23
|
+
return json;
|
|
24
|
+
}
|
|
25
|
+
export async function callDocsMcpTool(name, args) {
|
|
26
|
+
const json = await callJsonRpc('tools/call', { name, arguments: args });
|
|
27
|
+
if (json.error) {
|
|
28
|
+
throw new Error(`Salesforce Docs MCP error: ${json.error.message}`);
|
|
29
|
+
}
|
|
30
|
+
return json.result?.structuredContent ?? {};
|
|
31
|
+
}
|
|
32
|
+
export async function readDocsMcpResource(uri) {
|
|
33
|
+
const json = await callJsonRpc('resources/read', { uri });
|
|
34
|
+
if (json.error) {
|
|
35
|
+
throw new Error(`Salesforce Docs MCP error: ${json.error.message}`);
|
|
36
|
+
}
|
|
37
|
+
const text = json.result?.contents?.[0]?.text;
|
|
38
|
+
if (!text) {
|
|
39
|
+
throw new Error('Salesforce Docs MCP returned no content for resource ' + uri);
|
|
40
|
+
}
|
|
41
|
+
return JSON.parse(text);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=salesforceDocsClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salesforceDocsClient.js","sourceRoot":"","sources":["../../src/utils/salesforceDocsClient.ts"],"names":[],"mappings":"AAAA,mHAAm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tE,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,EAAE,iBAAiB,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAW;IACnD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1D,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IAC9C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,uDAAuD,GAAG,GAAG,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Public Salesforce Trailhead MCP server — see https://mcp.trailhead.salesforce.com/mcp
|
|
2
|
+
const TRAILHEAD_MCP_ENDPOINT = 'https://mcp.trailhead.salesforce.com/mcp';
|
|
3
|
+
async function callJsonRpc(method, params) {
|
|
4
|
+
const response = await fetch(TRAILHEAD_MCP_ENDPOINT, {
|
|
5
|
+
method: 'POST',
|
|
6
|
+
headers: {
|
|
7
|
+
'Content-Type': 'application/json',
|
|
8
|
+
Accept: 'application/json, text/event-stream',
|
|
9
|
+
},
|
|
10
|
+
body: JSON.stringify({ jsonrpc: '2.0', method, params, id: 1 }),
|
|
11
|
+
});
|
|
12
|
+
const text = await response.text();
|
|
13
|
+
let json;
|
|
14
|
+
try {
|
|
15
|
+
json = JSON.parse(text);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
throw new Error(`Trailhead MCP returned a non-JSON response (HTTP ${response.status}): ${text.slice(0, 500)}`);
|
|
19
|
+
}
|
|
20
|
+
if (!response.ok && !json.error) {
|
|
21
|
+
throw new Error(`Trailhead MCP request failed (HTTP ${response.status})`);
|
|
22
|
+
}
|
|
23
|
+
return json;
|
|
24
|
+
}
|
|
25
|
+
export async function callTrailheadMcpTool(name, args) {
|
|
26
|
+
const json = await callJsonRpc('tools/call', { name, arguments: args });
|
|
27
|
+
if (json.error) {
|
|
28
|
+
throw new Error(`Trailhead MCP error: ${json.error.message}`);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
structuredContent: json.result?.structuredContent,
|
|
32
|
+
content: json.result?.content ?? [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=trailheadClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trailheadClient.js","sourceRoot":"","sources":["../../src/utils/trailheadClient.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,sBAAsB,GAAG,0CAA0C,CAAC;AAU1E,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,MAA2B;IACpE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,sBAAsB,EAAE;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,MAAM,EAAE,qCAAqC;SAC9C;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;KAChE,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,IAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,oDAAoD,QAAQ,CAAC,MAAM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