@abgov/adsp-sdk-mcp-server 0.0.0
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 +51 -0
- package/assets/docs/architecture.md +79 -0
- package/assets/docs/getting-started.md +118 -0
- package/assets/docs/important-notes.md +47 -0
- package/assets/docs/index.md +9 -0
- package/assets/docs/platform/deployment.md +80 -0
- package/assets/docs/platform/getting-started.md +66 -0
- package/assets/docs/platform/operations.md +8 -0
- package/assets/docs/platform/platform-django-sdk.md +330 -0
- package/assets/docs/platform/platform-dotnet-sdk.md +457 -0
- package/assets/docs/platform/platform-flask-sdk.md +355 -0
- package/assets/docs/platform/platform-node-sdk.md +433 -0
- package/assets/docs/platform/platform-spring-sdk.md +344 -0
- package/assets/docs/platform/platform.md +8 -0
- package/assets/docs/services/access-service.md +75 -0
- package/assets/docs/services/agent-service.md +316 -0
- package/assets/docs/services/cache-service.md +61 -0
- package/assets/docs/services/calendar-service.md +86 -0
- package/assets/docs/services/comment-service.md +87 -0
- package/assets/docs/services/configuration-service.md +92 -0
- package/assets/docs/services/directory-service.md +57 -0
- package/assets/docs/services/event-service.md +122 -0
- package/assets/docs/services/feedback-service.md +152 -0
- package/assets/docs/services/file-service.md +164 -0
- package/assets/docs/services/form-service.md +149 -0
- package/assets/docs/services/notification-service.md +151 -0
- package/assets/docs/services/pdf-service.md +116 -0
- package/assets/docs/services/pii-service.md +45 -0
- package/assets/docs/services/push-service.md +106 -0
- package/assets/docs/services/services.md +6 -0
- package/assets/docs/services/status-service.md +29 -0
- package/assets/docs/services/task-service.md +139 -0
- package/assets/docs/services/tenant-service.md +18 -0
- package/assets/docs/services/token-handler.md +135 -0
- package/assets/docs/services/value-service.md +80 -0
- package/assets/docs/services/verify-service.md +61 -0
- package/assets/docs/tutorials/access-service/access-service.md +9 -0
- package/assets/docs/tutorials/access-service/adsp-clients.md +29 -0
- package/assets/docs/tutorials/access-service/application-clients.md +61 -0
- package/assets/docs/tutorials/access-service/front-end-access.md +53 -0
- package/assets/docs/tutorials/access-service/introduction.md +33 -0
- package/assets/docs/tutorials/access-service/tenants.md +68 -0
- package/assets/docs/tutorials/access-service/themes.md +43 -0
- package/assets/docs/tutorials/feedback-service/accessing-data.md +41 -0
- package/assets/docs/tutorials/feedback-service/feedback-service.md +9 -0
- package/assets/docs/tutorials/feedback-service/installation.md +142 -0
- package/assets/docs/tutorials/feedback-service/introduction.md +28 -0
- package/assets/docs/tutorials/feedback-service/security.md +40 -0
- package/assets/docs/tutorials/feedback-service/triggering.md +21 -0
- package/assets/docs/tutorials/file-service/file-service.md +9 -0
- package/assets/docs/tutorials/file-service/file-types.md +35 -0
- package/assets/docs/tutorials/file-service/introduction.md +34 -0
- package/assets/docs/tutorials/file-service/security.md +31 -0
- package/assets/docs/tutorials/file-service/working-with.md +65 -0
- package/assets/docs/tutorials/form-service/Integration.md +31 -0
- package/assets/docs/tutorials/form-service/ai-agent.md +450 -0
- package/assets/docs/tutorials/form-service/building-forms.md +264 -0
- package/assets/docs/tutorials/form-service/cheat-sheet.md +1461 -0
- package/assets/docs/tutorials/form-service/custom-error-messages.md +87 -0
- package/assets/docs/tutorials/form-service/data-registers.md +204 -0
- package/assets/docs/tutorials/form-service/file-uploader.md +81 -0
- package/assets/docs/tutorials/form-service/form-app.md +72 -0
- package/assets/docs/tutorials/form-service/form-editor.md +62 -0
- package/assets/docs/tutorials/form-service/form-service.md +9 -0
- package/assets/docs/tutorials/form-service/form-submissions.md +77 -0
- package/assets/docs/tutorials/form-service/instructions.md +173 -0
- package/assets/docs/tutorials/form-service/introduction.md +66 -0
- package/assets/docs/tutorials/form-service/repeated-items.md +87 -0
- package/assets/docs/tutorials/form-service/security.md +36 -0
- package/assets/docs/tutorials/form-service/steppers.md +237 -0
- package/assets/docs/tutorials/notification-service/emailAttachment.md +75 -0
- package/assets/docs/tutorials/notification-service/events.md +20 -0
- package/assets/docs/tutorials/notification-service/introduction.md +37 -0
- package/assets/docs/tutorials/notification-service/notification-service.md +9 -0
- package/assets/docs/tutorials/notification-service/notification-types.md +86 -0
- package/assets/docs/tutorials/notification-service/subscribers.md +33 -0
- package/assets/docs/tutorials/pdf-service/building-a-template.md +339 -0
- package/assets/docs/tutorials/pdf-service/generate-a-pdf.md +150 -0
- package/assets/docs/tutorials/pdf-service/handlebars.md +51 -0
- package/assets/docs/tutorials/pdf-service/introduction.md +26 -0
- package/assets/docs/tutorials/pdf-service/pdf-service.md +9 -0
- package/assets/docs/tutorials/pdf-service/puppeteer.md +25 -0
- package/assets/docs/tutorials/pdf-service/video.md +18 -0
- package/assets/docs/tutorials/status-service/Introduction.md +46 -0
- package/assets/docs/tutorials/status-service/health.md +51 -0
- package/assets/docs/tutorials/status-service/notices.md +34 -0
- package/assets/docs/tutorials/status-service/notifications.md +107 -0
- package/assets/docs/tutorials/status-service/status-service.md +9 -0
- package/assets/docs/tutorials/status-service/status.md +35 -0
- package/assets/docs/tutorials/status-service/webhooks.md +24 -0
- package/assets/docs/tutorials/task-service/introduction.md +23 -0
- package/assets/docs/tutorials/task-service/task-app.md +43 -0
- package/assets/docs/tutorials/task-service/task-definitions.md +49 -0
- package/assets/docs/tutorials/task-service/task-queues.md +67 -0
- package/assets/docs/tutorials/task-service/task-service.md +9 -0
- package/assets/docs/tutorials/tutorials.md +8 -0
- package/package.json +18 -0
- package/src/docs/docsRepository.d.ts +22 -0
- package/src/docs/docsRepository.js +110 -0
- package/src/docs/docsRepository.js.map +1 -0
- package/src/main.d.ts +2 -0
- package/src/main.js +16 -0
- package/src/main.js.map +1 -0
- package/src/sdk-reference/reference.d.ts +17 -0
- package/src/sdk-reference/reference.js +547 -0
- package/src/sdk-reference/reference.js.map +1 -0
- package/src/sdk-reference/search.d.ts +6 -0
- package/src/sdk-reference/search.js +41 -0
- package/src/sdk-reference/search.js.map +1 -0
- package/src/server.d.ts +6 -0
- package/src/server.js +30 -0
- package/src/server.js.map +1 -0
- package/src/tools/registerDocsTools.d.ts +3 -0
- package/src/tools/registerDocsTools.js +66 -0
- package/src/tools/registerDocsTools.js.map +1 -0
- package/src/tools/registerQuickstartTool.d.ts +2 -0
- package/src/tools/registerQuickstartTool.js +82 -0
- package/src/tools/registerQuickstartTool.js.map +1 -0
- package/src/tools/registerSdkTools.d.ts +2 -0
- package/src/tools/registerSdkTools.js +43 -0
- package/src/tools/registerSdkTools.js.map +1 -0
- package/src/tools/types.d.ts +12 -0
- package/src/tools/types.js +3 -0
- package/src/tools/types.js.map +1 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SDK_REFERENCE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Curated reference for every symbol exported from the root of `@abgov/adsp-service-sdk`
|
|
6
|
+
* (libs/adsp-service-sdk/src/index.ts). Coverage against that export list is enforced by
|
|
7
|
+
* reference.spec.ts so this stays in sync as the SDK evolves.
|
|
8
|
+
*/
|
|
9
|
+
exports.SDK_REFERENCE = [
|
|
10
|
+
// initialize
|
|
11
|
+
{
|
|
12
|
+
name: 'initializePlatform',
|
|
13
|
+
kind: 'function',
|
|
14
|
+
module: 'initialize',
|
|
15
|
+
summary: "SDK's main entry point for a multi-tenant platform service; sets up all core capabilities.",
|
|
16
|
+
details: 'async initializePlatform(options: PlatformOptions, logOptions: Logger | LogOptions, services?: Partial<PlatformServices>): Promise<PlatformCapabilities>\n\n' +
|
|
17
|
+
'Fixes realm to "core". options extends ServiceRegistration with: clientSecret, directoryUrl, accessServiceUrl, ' +
|
|
18
|
+
'ignoreServiceAud?, configurationConverter?, combineConfiguration?, enableConfigurationInvalidation?, ' +
|
|
19
|
+
'useLongConfigurationCacheTTL?, additionalExtractors?, tracing? (TracingOptions | OTLP endpoint string), ' +
|
|
20
|
+
'metrics? (MetricsOptions | OTLP endpoint string).\n\n' +
|
|
21
|
+
'Returns PlatformCapabilities: directory, tenantService, configurationService, eventService, tokenProvider, ' +
|
|
22
|
+
'coreStrategy, tenantStrategy, tenantHandler, configurationHandler, healthCheck, clearCached(tenantId, serviceId), ' +
|
|
23
|
+
'metricsHandler, traceHandler, tracerProvider? (only if tracing enabled), meterProvider? (only if metrics enabled), logger.\n\n' +
|
|
24
|
+
'Also triggers a fire-and-forget registration of roles/events/configuration schema/notifications/etc with the ' +
|
|
25
|
+
'relevant platform services (see ServiceRegistration).',
|
|
26
|
+
example: "import { AdspId, initializePlatform } from '@abgov/adsp-service-sdk';\n\n" +
|
|
27
|
+
"const serviceId = AdspId.parse(environment.CLIENT_ID);\n" +
|
|
28
|
+
"const { coreStrategy, tenantStrategy, ...sdkCapabilities } = await initializePlatform(\n" +
|
|
29
|
+
" {\n" +
|
|
30
|
+
" displayName: 'My platform service',\n" +
|
|
31
|
+
" description: 'Example of a platform service.',\n" +
|
|
32
|
+
" serviceId,\n" +
|
|
33
|
+
" accessServiceUrl: new URL(environment.KEYCLOAK_ROOT_URL),\n" +
|
|
34
|
+
" clientSecret: environment.CLIENT_SECRET,\n" +
|
|
35
|
+
" directoryUrl: new URL(environment.DIRECTORY_URL),\n" +
|
|
36
|
+
" configurationSchema,\n" +
|
|
37
|
+
" events: [],\n" +
|
|
38
|
+
" roles: [],\n" +
|
|
39
|
+
" notifications: [],\n" +
|
|
40
|
+
" },\n" +
|
|
41
|
+
" { logger }\n" +
|
|
42
|
+
");",
|
|
43
|
+
seeAlso: ['initializeService', 'ServiceRegistration'],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'initializeService',
|
|
47
|
+
kind: 'function',
|
|
48
|
+
module: 'initialize',
|
|
49
|
+
summary: 'Entry point for a single-tenant (tenant-scoped) service; thin wrapper over initializePlatform.',
|
|
50
|
+
details: 'async initializeService(options: Omit<PlatformOptions, "ignoreServiceAud">, logOptions: Logger | LogOptions): ' +
|
|
51
|
+
'Promise<Capabilities>\n\n' +
|
|
52
|
+
'Resolves the service\'s single tenant via tenantService.getTenants()[0] and returns a reshaped capability set: ' +
|
|
53
|
+
'same as PlatformCapabilities but without tenantService/tenantHandler, and clearCached is reshaped to ' +
|
|
54
|
+
'(serviceId: AdspId) => void (tenant is implicit).',
|
|
55
|
+
seeAlso: ['initializePlatform'],
|
|
56
|
+
},
|
|
57
|
+
// access
|
|
58
|
+
{
|
|
59
|
+
name: 'authorize',
|
|
60
|
+
kind: 'function',
|
|
61
|
+
module: 'access',
|
|
62
|
+
summary: 'Returns Express middleware enforcing role-based access control; user must have at least one of the given roles.',
|
|
63
|
+
details: 'authorize(...roles: string[]): RequestHandler\n\n' +
|
|
64
|
+
'Passes an UnauthorizedUserError to next() (mapped to 403 by createErrorHandler) if req.user is missing or lacks ' +
|
|
65
|
+
'every listed role.',
|
|
66
|
+
example: "router.get('/resource', authorize('admin'), handler);",
|
|
67
|
+
seeAlso: ['UnauthorizedUserError', 'hasRequiredRole', 'createErrorHandler'],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'hasRequiredRole',
|
|
71
|
+
kind: 'function',
|
|
72
|
+
module: 'access',
|
|
73
|
+
summary: "Returns true if the user has at least one of the given roles.",
|
|
74
|
+
details: 'hasRequiredRole(user: User, roles: string | string[]): boolean',
|
|
75
|
+
seeAlso: ['authorize', 'isAllowedUser'],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'isAllowedUser',
|
|
79
|
+
kind: 'function',
|
|
80
|
+
module: 'access',
|
|
81
|
+
summary: 'Checks both tenant match and role match for a user; used by the AssertRole decorator.',
|
|
82
|
+
details: 'isAllowedUser(user: User, tenantId: AdspId, roles: string | string[], allowCore = false): boolean\n\n' +
|
|
83
|
+
'Allowed if (allowCore and user.isCore) or the user has a tenantId matching tenantId (or no tenantId context ' +
|
|
84
|
+
'given), AND the user has at least one of the roles.',
|
|
85
|
+
seeAlso: ['hasRequiredRole', 'AssertRole'],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'AssertRole',
|
|
89
|
+
kind: 'decorator',
|
|
90
|
+
module: 'access',
|
|
91
|
+
summary: 'Method decorator that throws UnauthorizedUserError unless the caller (first argument, a User) has a required role.',
|
|
92
|
+
details: 'AssertRole(operation: string, roles: string | string[], roleProperties?: string | string[], allowCore = false)\n\n' +
|
|
93
|
+
'roleProperties names additional instance properties (arrays of role strings) to combine into the required set. ' +
|
|
94
|
+
'Tenant match is enforced via isAllowedUser using this.tenantId on the decorated instance.',
|
|
95
|
+
seeAlso: ['AssertCoreRole', 'isAllowedUser'],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'AssertCoreRole',
|
|
99
|
+
kind: 'decorator',
|
|
100
|
+
module: 'access',
|
|
101
|
+
summary: 'Method decorator that throws UnauthorizedUserError unless the caller is a core-realm user with a required role.',
|
|
102
|
+
details: 'AssertCoreRole(operation: string, roles: string | string[])',
|
|
103
|
+
seeAlso: ['AssertRole'],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'UnauthorizedUserError',
|
|
107
|
+
kind: 'class',
|
|
108
|
+
module: 'access',
|
|
109
|
+
summary: 'GoAError (HTTP 403) thrown when a user is not permitted to perform an operation.',
|
|
110
|
+
details: 'new UnauthorizedUserError(operation: string, user: User, extra?: GoAErrorExtra)',
|
|
111
|
+
seeAlso: ['GoAError', 'createErrorHandler'],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'TokenProvider',
|
|
115
|
+
kind: 'interface',
|
|
116
|
+
module: 'access',
|
|
117
|
+
summary: "Provides the service's own cached client-credentials access token.",
|
|
118
|
+
details: 'interface TokenProvider { getAccessToken(): Promise<string>; }\n\n' +
|
|
119
|
+
'The token is cached and refreshed automatically near expiry; obtained from PlatformCapabilities.tokenProvider.',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'User',
|
|
123
|
+
kind: 'interface',
|
|
124
|
+
module: 'access',
|
|
125
|
+
summary: 'Shape of the authenticated user set on req.user by the SDK Passport strategies.',
|
|
126
|
+
details: 'interface User {\n' +
|
|
127
|
+
' id: string; name: string; email: string; roles: string[];\n' +
|
|
128
|
+
' tenantId?: AdspId; isCore: boolean;\n' +
|
|
129
|
+
' token: { azp: string; aud: string; iss: string; bearer: string; email_verified: boolean; [x: string]: unknown };\n' +
|
|
130
|
+
'}',
|
|
131
|
+
},
|
|
132
|
+
// utils
|
|
133
|
+
{
|
|
134
|
+
name: 'AdspId',
|
|
135
|
+
kind: 'class',
|
|
136
|
+
module: 'utils',
|
|
137
|
+
summary: 'Utility class for parsing and formatting ADSP URNs (urn:ads:{namespace}:{service}:{api}:{resource}).',
|
|
138
|
+
details: 'AdspId.parse(urn: string): AdspId — throws AdspIdFormatError on malformed input.\n' +
|
|
139
|
+
'AdspId.isAdspId(value: unknown): boolean — cheap format check without throwing.\n' +
|
|
140
|
+
'instance.type is one of "namespace" | "service" | "api" | "resource" depending on how many URN segments were given.\n' +
|
|
141
|
+
'instance.toString() reconstructs the URN string.',
|
|
142
|
+
example: "const serviceId = AdspId.parse('urn:ads:platform:event-service:v1');",
|
|
143
|
+
seeAlso: ['adspId', 'assertAdspId', 'AdspIdFormatError'],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'adspId',
|
|
147
|
+
kind: 'function',
|
|
148
|
+
module: 'utils',
|
|
149
|
+
summary: 'Tagged template literal helper that builds and parses an AdspId in one step.',
|
|
150
|
+
example: "const serviceId = adspId`urn:ads:platform:event-service:v1`;",
|
|
151
|
+
seeAlso: ['AdspId'],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'assertAdspId',
|
|
155
|
+
kind: 'function',
|
|
156
|
+
module: 'utils',
|
|
157
|
+
summary: 'Throws unless an AdspId is one of the given resource types.',
|
|
158
|
+
details: "assertAdspId(id: AdspId, errorMessage?: string, ...types: ('namespace'|'service'|'api'|'resource')[]): void",
|
|
159
|
+
seeAlso: ['AdspId'],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'AdspIdFormatError',
|
|
163
|
+
kind: 'class',
|
|
164
|
+
module: 'utils',
|
|
165
|
+
summary: 'GoAError (HTTP 400) thrown when a string does not parse as a valid ADSP URN.',
|
|
166
|
+
seeAlso: ['AdspId', 'GoAError'],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'GoAError',
|
|
170
|
+
kind: 'class',
|
|
171
|
+
module: 'utils',
|
|
172
|
+
summary: 'Base error class used across the SDK, carrying an `extra` bag with statusCode/type/id/parent.',
|
|
173
|
+
details: 'new GoAError(message?: string, extra?: GoAErrorExtra)\n\ncreateErrorHandler reads extra.statusCode to set the HTTP response status.',
|
|
174
|
+
seeAlso: ['GoAErrorExtra', 'createErrorHandler'],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'GoAErrorExtra',
|
|
178
|
+
kind: 'interface',
|
|
179
|
+
module: 'utils',
|
|
180
|
+
summary: 'Shape of the `extra` property carried by GoAError.',
|
|
181
|
+
details: 'interface GoAErrorExtra { name?: string; statusCode?: number; type?: string; parent?: Error; id?: string; }',
|
|
182
|
+
seeAlso: ['GoAError'],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: 'createErrorHandler',
|
|
186
|
+
kind: 'function',
|
|
187
|
+
module: 'utils',
|
|
188
|
+
summary: 'Returns Express error-handling middleware that normalizes GoAError (and generic errors) into a JSON error response.',
|
|
189
|
+
details: 'createErrorHandler(logger?: Logger): ErrorRequestHandler\n\n' +
|
|
190
|
+
'Reads err.extra.statusCode (GoAError) or err.statusCode, defaults to 500. In production, 5xx messages are ' +
|
|
191
|
+
'replaced with "Internal server error". Logs statusCode/path/method/correlationId when a logger is given. Mount last: app.use(createErrorHandler(logger)).',
|
|
192
|
+
seeAlso: ['GoAError'],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'createValidationHandler',
|
|
196
|
+
kind: 'function',
|
|
197
|
+
module: 'utils',
|
|
198
|
+
summary: 'Returns Express middleware that validates a request property against a Zod schema, passing ValidationFailedError (400) on failure.',
|
|
199
|
+
details: 'createValidationHandler<T>(schema: ZodSchema<T>, source?: (req: Request) => unknown): RequestHandler\n\n' +
|
|
200
|
+
'Defaults to validating req.body; pass a custom source function to validate query/params instead.',
|
|
201
|
+
example: "router.post('/resource', createValidationHandler(MySchema), handler);\n" +
|
|
202
|
+
"router.get('/search', createValidationHandler(QuerySchema, (req) => req.query), handler);",
|
|
203
|
+
seeAlso: ['ValidationFailedError', 'createErrorHandler'],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'ValidationFailedError',
|
|
207
|
+
kind: 'class',
|
|
208
|
+
module: 'utils',
|
|
209
|
+
summary: 'GoAError (HTTP 400) thrown by createValidationHandler when Zod validation fails.',
|
|
210
|
+
seeAlso: ['createValidationHandler'],
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'toKebabCase',
|
|
214
|
+
kind: 'function',
|
|
215
|
+
module: 'utils',
|
|
216
|
+
summary: 'Strict kebab-case conversion for IDs: lowercase alphanumeric and hyphens only.',
|
|
217
|
+
example: "toKebabCase('My Form!') // 'my-form'",
|
|
218
|
+
seeAlso: ['toKebabName'],
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: 'toKebabName',
|
|
222
|
+
kind: 'function',
|
|
223
|
+
module: 'utils',
|
|
224
|
+
summary: 'Legacy kebab-case conversion for tenant names only: lowercases and replaces spaces with hyphens (preserves underscores).',
|
|
225
|
+
details: 'Kept for backward compatibility with existing tenant names. Use toKebabCase for new IDs.',
|
|
226
|
+
deprecated: true,
|
|
227
|
+
seeAlso: ['toKebabCase'],
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'retry',
|
|
231
|
+
kind: 'const',
|
|
232
|
+
module: 'utils',
|
|
233
|
+
summary: 'Exponential-backoff Cockatiel retry policy (10 attempts) used internally by SDK HTTP calls; exposed for consumer use.',
|
|
234
|
+
example: 'await retry.execute(async ({ attempt }) => { /* ... */ });',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'LimitToOne',
|
|
238
|
+
kind: 'decorator',
|
|
239
|
+
module: 'utils',
|
|
240
|
+
summary: 'Method decorator that de-dupes concurrent calls to an async method sharing a key, so only one execution is in flight at a time.',
|
|
241
|
+
details: 'LimitToOne(getKey?: (propertyKey: string, ...args) => string)\n\n' +
|
|
242
|
+
'Callers made while an execution is in-flight for the same key share that same promise. Return a falsy key to force ' +
|
|
243
|
+
'independent execution. Used internally for token/directory/tenant/configuration retrieval.',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'addTraceFormat',
|
|
247
|
+
kind: 'function',
|
|
248
|
+
module: 'utils',
|
|
249
|
+
summary: 'Winston log format that adds the active OpenTelemetry trace ID to log entries.',
|
|
250
|
+
details: 'addTraceFormat(): Format\n\n' +
|
|
251
|
+
"Adds a `trace` field (from getContextTrace()) to log info if not already set. Used internally by createLogger's default format chain.",
|
|
252
|
+
seeAlso: ['getContextTrace'],
|
|
253
|
+
},
|
|
254
|
+
// directory
|
|
255
|
+
{
|
|
256
|
+
name: 'ServiceDirectory',
|
|
257
|
+
kind: 'interface',
|
|
258
|
+
module: 'directory',
|
|
259
|
+
summary: 'Looks up service/API/resource URLs from the ADSP directory of services.',
|
|
260
|
+
details: 'interface ServiceDirectory {\n' +
|
|
261
|
+
' getServiceUrl(serviceId: AdspId): Promise<URL>;\n' +
|
|
262
|
+
' getResourceUrl(resourceId: AdspId): Promise<URL>;\n' +
|
|
263
|
+
'}\n\n' +
|
|
264
|
+
'Directory entries are cached per namespace with a 10hr TTL. Entries can be overridden with env vars of the ' +
|
|
265
|
+
'form DIR_{NAMESPACE}_{SERVICE}[_{API}] (e.g. DIR_PLATFORM_EVENT_SERVICE). Obtained from PlatformCapabilities.directory.',
|
|
266
|
+
example: "const eventServiceUrl = await directory.getServiceUrl(adspId`urn:ads:platform:event-service:v1`);",
|
|
267
|
+
},
|
|
268
|
+
// tenant
|
|
269
|
+
{
|
|
270
|
+
name: 'Tenant',
|
|
271
|
+
kind: 'interface',
|
|
272
|
+
module: 'tenant',
|
|
273
|
+
summary: 'Tenant record shape.',
|
|
274
|
+
details: 'interface Tenant { id: AdspId; name: string; realm: string; }',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'TenantService',
|
|
278
|
+
kind: 'interface',
|
|
279
|
+
module: 'tenant',
|
|
280
|
+
summary: 'Looks up tenant records by ID, name, or Keycloak realm.',
|
|
281
|
+
details: 'interface TenantService {\n' +
|
|
282
|
+
' getTenants(): Promise<Tenant[]>;\n' +
|
|
283
|
+
' getTenant(tenantId: AdspId): Promise<Tenant>;\n' +
|
|
284
|
+
' getTenantByName(name: string): Promise<Tenant>;\n' +
|
|
285
|
+
' getTenantByRealm(realm: string): Promise<Tenant>;\n' +
|
|
286
|
+
'}\n\n' +
|
|
287
|
+
'Preloads all tenants on construction and caches results with a 10hr TTL. Obtained from PlatformCapabilities.tenantService (not available on initializeService capabilities, since a tenant service only has its own tenant).',
|
|
288
|
+
seeAlso: ['Tenant'],
|
|
289
|
+
},
|
|
290
|
+
// configuration
|
|
291
|
+
{
|
|
292
|
+
name: 'ConfigurationService',
|
|
293
|
+
kind: 'interface',
|
|
294
|
+
module: 'configuration',
|
|
295
|
+
summary: "Retrieves a service's tenant and/or core configuration from the configuration-service, with caching.",
|
|
296
|
+
details: 'interface ConfigurationService {\n' +
|
|
297
|
+
' getConfiguration<C, R = [C, C]>(serviceId: AdspId, token: string, tenantId?: AdspId): Promise<R>;\n' +
|
|
298
|
+
' getServiceConfiguration<C, R = [C, C, number?]>(name?: string, tenantId?: AdspId): Promise<R>;\n' +
|
|
299
|
+
' getServiceConfigurationRevision<C, R = [C, C, number?]>(revision: string, name?: string, tenantId?: AdspId): Promise<R>;\n' +
|
|
300
|
+
'}\n\n' +
|
|
301
|
+
'getServiceConfiguration/getServiceConfigurationRevision use the service account context configured via ' +
|
|
302
|
+
'initializePlatform (name is only required when the service registered configuration with useNamespace: true). ' +
|
|
303
|
+
'Results are combined via the combineConfiguration option (default: [tenantConfig, coreConfig]). Obtained from ' +
|
|
304
|
+
'PlatformCapabilities.configurationService; req.getConfiguration()/req.getServiceConfiguration() on requests are ' +
|
|
305
|
+
'set by configurationHandler as convenience wrappers.',
|
|
306
|
+
seeAlso: ['ServiceRegistration'],
|
|
307
|
+
},
|
|
308
|
+
// event
|
|
309
|
+
{
|
|
310
|
+
name: 'EventService',
|
|
311
|
+
kind: 'interface',
|
|
312
|
+
module: 'event',
|
|
313
|
+
summary: 'Sends domain events; only events registered via ServiceRegistration.events can be sent.',
|
|
314
|
+
details: 'interface EventService { send(event: DomainEvent): void; }\n\n' +
|
|
315
|
+
"Sends use the service's name as event namespace, POSTing to event-service v1 /v1/events. Failures are logged, " +
|
|
316
|
+
'not thrown, so a failed send does not interrupt the caller.',
|
|
317
|
+
example: "eventService.send({\n name: 'my-event-started',\n timestamp: new Date(),\n payload: {},\n});",
|
|
318
|
+
seeAlso: ['DomainEvent', 'DomainEventDefinition'],
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'DomainEvent',
|
|
322
|
+
kind: 'interface',
|
|
323
|
+
module: 'event',
|
|
324
|
+
summary: 'Shape of an event passed to EventService.send.',
|
|
325
|
+
details: 'interface DomainEvent {\n' +
|
|
326
|
+
' name: string; timestamp: Date; correlationId?: string; tenantId?: AdspId;\n' +
|
|
327
|
+
' context?: Record<string, boolean | number | string>;\n' +
|
|
328
|
+
' payload: Record<string, unknown>;\n' +
|
|
329
|
+
'}',
|
|
330
|
+
seeAlso: ['EventService'],
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: 'DomainEventDefinition',
|
|
334
|
+
kind: 'interface',
|
|
335
|
+
module: 'event',
|
|
336
|
+
summary: 'Registration shape for a domain event definition, passed to ServiceRegistration.events.',
|
|
337
|
+
details: 'interface DomainEventDefinition {\n' +
|
|
338
|
+
' name: string; description: string; payloadSchema: Record<string, unknown>;\n' +
|
|
339
|
+
' interval?: IntervalDefinition; log?: EventLogConfiguration;\n' +
|
|
340
|
+
'}',
|
|
341
|
+
seeAlso: ['ServiceRegistration', 'IntervalDefinition', 'EventLogConfiguration'],
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: 'IntervalDefinition',
|
|
345
|
+
kind: 'interface',
|
|
346
|
+
module: 'event',
|
|
347
|
+
summary: 'Defines the start-event pairing for an interval metric on the event that represents the end of the interval.',
|
|
348
|
+
details: 'interface IntervalDefinition {\n' +
|
|
349
|
+
' metric: string | string[]; namespace: string; name: string; context?: string | string[];\n' +
|
|
350
|
+
'}\n\n' +
|
|
351
|
+
'Interval events are matched by correlation ID (and optionally by context values, if the correlation ID is not unique to the interval).',
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
name: 'EventLogConfiguration',
|
|
355
|
+
kind: 'interface',
|
|
356
|
+
module: 'event',
|
|
357
|
+
summary: 'Per-event-definition flag to suppress event-log persistence.',
|
|
358
|
+
details: 'interface EventLogConfiguration { skip: boolean; }',
|
|
359
|
+
},
|
|
360
|
+
// file
|
|
361
|
+
{
|
|
362
|
+
name: 'FileType',
|
|
363
|
+
kind: 'interface',
|
|
364
|
+
module: 'file',
|
|
365
|
+
summary: 'File-service file-type registration shape, passed to ServiceRegistration.fileTypes.',
|
|
366
|
+
details: 'interface FileType {\n' +
|
|
367
|
+
' id: string; name: string; anonymousRead: boolean;\n' +
|
|
368
|
+
' readRoles: string[]; updateRoles: string[];\n' +
|
|
369
|
+
' rules?: FileTypeRules; securityClassification?: string;\n' +
|
|
370
|
+
'}',
|
|
371
|
+
seeAlso: ['FileTypeRules', 'ServiceRegistration'],
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: 'FileTypeRules',
|
|
375
|
+
kind: 'interface',
|
|
376
|
+
module: 'file',
|
|
377
|
+
summary: 'Rules for a file type, currently just retention.',
|
|
378
|
+
details: 'interface FileTypeRules { retention?: { active: true; deleteInDays: number }; }',
|
|
379
|
+
seeAlso: ['FileType'],
|
|
380
|
+
},
|
|
381
|
+
// common
|
|
382
|
+
{
|
|
383
|
+
name: 'SecurityClassifications',
|
|
384
|
+
kind: 'enum',
|
|
385
|
+
module: 'common',
|
|
386
|
+
summary: 'Security classification levels used across service configuration (e.g. FileType.securityClassification).',
|
|
387
|
+
details: "enum SecurityClassifications { ProtectedA = 'protected a', ProtectedB = 'protected b', ProtectedC = 'protected c', Public = 'public' }",
|
|
388
|
+
},
|
|
389
|
+
// push
|
|
390
|
+
{
|
|
391
|
+
name: 'Stream',
|
|
392
|
+
kind: 'interface',
|
|
393
|
+
module: 'push',
|
|
394
|
+
summary: 'Push-service event-stream registration shape, passed to ServiceRegistration.eventStreams.',
|
|
395
|
+
details: 'interface Stream {\n' +
|
|
396
|
+
' id: string; name: string; description: string;\n' +
|
|
397
|
+
' events: StreamEvent[]; subscriberRoles: string[]; publicSubscribe: boolean;\n' +
|
|
398
|
+
'}\n\n' +
|
|
399
|
+
'Streams make sets of events available over push-mode endpoints (socket.io or SSE) in push-service.',
|
|
400
|
+
seeAlso: ['StreamEvent', 'EventCriteria', 'ServiceRegistration'],
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: 'StreamEvent',
|
|
404
|
+
kind: 'interface',
|
|
405
|
+
module: 'push',
|
|
406
|
+
summary: 'One event mapping within a Stream.',
|
|
407
|
+
details: 'interface StreamEvent { namespace: string; name: string; map?: Record<string, string>; criteria?: EventCriteria; }',
|
|
408
|
+
seeAlso: ['Stream', 'EventCriteria'],
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: 'EventCriteria',
|
|
412
|
+
kind: 'interface',
|
|
413
|
+
module: 'push',
|
|
414
|
+
summary: 'Correlation ID / context filter for a StreamEvent.',
|
|
415
|
+
details: 'interface EventCriteria { correlationId?: string; context?: Record<string, boolean | number | string>; }',
|
|
416
|
+
seeAlso: ['StreamEvent'],
|
|
417
|
+
},
|
|
418
|
+
// notification
|
|
419
|
+
{
|
|
420
|
+
name: 'Channel',
|
|
421
|
+
kind: 'enum',
|
|
422
|
+
module: 'notification',
|
|
423
|
+
summary: 'Notification delivery channels.',
|
|
424
|
+
details: "enum Channel { email = 'email', mail = 'mail', sms = 'sms', bot = 'bot' }",
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
name: 'NotificationType',
|
|
428
|
+
kind: 'interface',
|
|
429
|
+
module: 'notification',
|
|
430
|
+
summary: 'Notification-service notification-type registration shape, passed to ServiceRegistration.notifications.',
|
|
431
|
+
details: 'interface NotificationType {\n' +
|
|
432
|
+
' name: string; displayName?: string; description: string;\n' +
|
|
433
|
+
' publicSubscribe: boolean; manageSubscribe?: boolean; subscriberRoles: string[];\n' +
|
|
434
|
+
' events: NotificationTypeEvent[]; channels: Channel[];\n' +
|
|
435
|
+
' addressPath?: string; ccPath?: string; bccPath?: string; attachmentPath?: string;\n' +
|
|
436
|
+
' subjectPath?: string; titlePath?: string; subTitlePath?: string;\n' +
|
|
437
|
+
'}',
|
|
438
|
+
seeAlso: ['NotificationTypeEvent', 'Template', 'Channel', 'ServiceRegistration'],
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
name: 'NotificationTypeEvent',
|
|
442
|
+
kind: 'interface',
|
|
443
|
+
module: 'notification',
|
|
444
|
+
summary: 'Maps a domain event to per-channel notification templates within a NotificationType.',
|
|
445
|
+
details: 'interface NotificationTypeEvent {\n' +
|
|
446
|
+
' namespace: string; name: string;\n' +
|
|
447
|
+
' templates: Partial<Record<Channel, Template>>; attachments?: string | string[];\n' +
|
|
448
|
+
'}',
|
|
449
|
+
seeAlso: ['NotificationType', 'Template'],
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: 'Template',
|
|
453
|
+
kind: 'interface',
|
|
454
|
+
module: 'notification',
|
|
455
|
+
summary: 'A notification template body/subject (Handlebars-templated), for a given channel.',
|
|
456
|
+
details: 'interface Template { subject: unknown; body: unknown; title?: string; subtitle?: string; }',
|
|
457
|
+
seeAlso: ['NotificationTypeEvent'],
|
|
458
|
+
},
|
|
459
|
+
// value
|
|
460
|
+
{
|
|
461
|
+
name: 'ValueDefinition',
|
|
462
|
+
kind: 'interface',
|
|
463
|
+
module: 'value',
|
|
464
|
+
summary: 'Value-service time-series definition shape, passed to ServiceRegistration.values.',
|
|
465
|
+
details: 'interface ValueDefinition { id: string; name: string; description: string; jsonSchema: Record<string, unknown>; }',
|
|
466
|
+
seeAlso: ['ServiceRegistration'],
|
|
467
|
+
},
|
|
468
|
+
// registration
|
|
469
|
+
{
|
|
470
|
+
name: 'ServiceRegistration',
|
|
471
|
+
kind: 'interface',
|
|
472
|
+
module: 'registration',
|
|
473
|
+
summary: 'Options passed to initializePlatform/initializeService describing everything the service registers with the platform.',
|
|
474
|
+
details: 'interface ServiceRegistration {\n' +
|
|
475
|
+
' serviceId: AdspId; // also used as the client ID\n' +
|
|
476
|
+
' displayName: string; description: string;\n' +
|
|
477
|
+
' roles?: (string | ServiceRole)[];\n' +
|
|
478
|
+
' configurationSchema?: Record<string, unknown>; // deprecated, use `configuration`\n' +
|
|
479
|
+
' configuration?: { schema: Record<string, unknown>; description: string; useNamespace?: boolean };\n' +
|
|
480
|
+
' events?: DomainEventDefinition[];\n' +
|
|
481
|
+
' eventStreams?: Stream[];\n' +
|
|
482
|
+
' fileTypes?: FileType[];\n' +
|
|
483
|
+
' notifications?: NotificationType[];\n' +
|
|
484
|
+
' values?: ValueDefinition[];\n' +
|
|
485
|
+
' serviceConfigurations?: { serviceId: AdspId; configuration: Record<string, unknown> | { name: string; configuration: unknown }[] }[];\n' +
|
|
486
|
+
'}\n\n' +
|
|
487
|
+
'On initialization these are patched (fire-and-forget) into configuration-service (roles/config/events/etc as ' +
|
|
488
|
+
'namespaced documents), tenant-service (roles), event-service (event definitions), push-service (event streams), ' +
|
|
489
|
+
'file-service (file types), notification-service (notification types), and value-service (value definitions).',
|
|
490
|
+
seeAlso: ['ServiceRole', 'initializePlatform'],
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: 'ServiceRole',
|
|
494
|
+
kind: 'interface',
|
|
495
|
+
module: 'registration',
|
|
496
|
+
summary: 'A service role registered via ServiceRegistration.roles.',
|
|
497
|
+
details: 'interface ServiceRole {\n' +
|
|
498
|
+
' role: string; description: string;\n' +
|
|
499
|
+
' inTenantAdmin?: boolean; // if true, included in the tenant admin composite role\n' +
|
|
500
|
+
'}',
|
|
501
|
+
seeAlso: ['ServiceRegistration'],
|
|
502
|
+
},
|
|
503
|
+
// metrics
|
|
504
|
+
{
|
|
505
|
+
name: 'benchmark',
|
|
506
|
+
kind: 'function',
|
|
507
|
+
module: 'metrics',
|
|
508
|
+
summary: 'Manually starts/stops a named timing on the request, recording it as a value-service metric.',
|
|
509
|
+
details: 'benchmark(req: Request, metric: string, value?: number): void',
|
|
510
|
+
deprecated: true,
|
|
511
|
+
seeAlso: ['startBenchmark'],
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: 'startBenchmark',
|
|
515
|
+
kind: 'function',
|
|
516
|
+
module: 'metrics',
|
|
517
|
+
summary: 'Returns a closure that stops a named timing started on the request.',
|
|
518
|
+
details: 'startBenchmark(req: Request, metric: string): () => void',
|
|
519
|
+
deprecated: true,
|
|
520
|
+
seeAlso: ['benchmark'],
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: 'ServiceMetricsValueDefinition',
|
|
524
|
+
kind: 'const',
|
|
525
|
+
module: 'metrics',
|
|
526
|
+
summary: 'Legacy value-service definition for the "service-metrics" value stream (response times).',
|
|
527
|
+
deprecated: true,
|
|
528
|
+
seeAlso: ['ValueDefinition'],
|
|
529
|
+
},
|
|
530
|
+
// trace
|
|
531
|
+
{
|
|
532
|
+
name: 'getContextTrace',
|
|
533
|
+
kind: 'function',
|
|
534
|
+
module: 'trace',
|
|
535
|
+
summary: "Returns the current OpenTelemetry span's W3C traceparent string, or null if there is no active span.",
|
|
536
|
+
details: 'getContextTrace(): { toString(): string } | null',
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: 'instrumentAxios',
|
|
540
|
+
kind: 'function',
|
|
541
|
+
module: 'trace',
|
|
542
|
+
summary: 'Attaches axios request/response interceptors that log per-request timing.',
|
|
543
|
+
details: 'instrumentAxios(logger: Logger): void\n\nLightweight, non-OpenTelemetry timing log; typically called once near app startup.',
|
|
544
|
+
example: "instrumentAxios(logger);",
|
|
545
|
+
},
|
|
546
|
+
];
|
|
547
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../../../libs/adsp-sdk-mcp-server/src/sdk-reference/reference.ts"],"names":[],"mappings":";;;AAaA;;;;GAIG;AACU,QAAA,aAAa,GAAmB;IAC3C,aAAa;IACb;QACE,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,4FAA4F;QACrG,OAAO,EACL,8JAA8J;YAC9J,iHAAiH;YACjH,uGAAuG;YACvG,0GAA0G;YAC1G,uDAAuD;YACvD,6GAA6G;YAC7G,oHAAoH;YACpH,gIAAgI;YAChI,+GAA+G;YAC/G,uDAAuD;QACzD,OAAO,EACL,2EAA2E;YAC3E,0DAA0D;YAC1D,0FAA0F;YAC1F,OAAO;YACP,2CAA2C;YAC3C,sDAAsD;YACtD,kBAAkB;YAClB,iEAAiE;YACjE,gDAAgD;YAChD,yDAAyD;YACzD,4BAA4B;YAC5B,mBAAmB;YACnB,kBAAkB;YAClB,0BAA0B;YAC1B,QAAQ;YACR,gBAAgB;YAChB,IAAI;QACN,OAAO,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;KACtD;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,gGAAgG;QACzG,OAAO,EACL,gHAAgH;YAChH,2BAA2B;YAC3B,iHAAiH;YACjH,u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E,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,2EAA2E;QACpF,OAAO,EAAE,6HAA6H;QACtI,OAAO,EAAE,0BAA0B;KACpC;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SdkSymbolDoc } from './reference';
|
|
2
|
+
/**
|
|
3
|
+
* Searches the curated SDK reference by symbol name, module, and summary/details text.
|
|
4
|
+
* Ranks exact/prefix name matches highest so an exact symbol name always surfaces as the top hit.
|
|
5
|
+
*/
|
|
6
|
+
export declare function searchSdkReference(query: string, limit?: number): SdkSymbolDoc[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchSdkReference = searchSdkReference;
|
|
4
|
+
const reference_1 = require("./reference");
|
|
5
|
+
function tokenize(text) {
|
|
6
|
+
return text.toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Searches the curated SDK reference by symbol name, module, and summary/details text.
|
|
10
|
+
* Ranks exact/prefix name matches highest so an exact symbol name always surfaces as the top hit.
|
|
11
|
+
*/
|
|
12
|
+
function searchSdkReference(query, limit = 5) {
|
|
13
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
14
|
+
if (!normalizedQuery) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const terms = tokenize(query);
|
|
18
|
+
return reference_1.SDK_REFERENCE.map((symbol) => {
|
|
19
|
+
const name = symbol.name.toLowerCase();
|
|
20
|
+
let score = 0;
|
|
21
|
+
if (name === normalizedQuery) {
|
|
22
|
+
score += 100;
|
|
23
|
+
}
|
|
24
|
+
else if (name.startsWith(normalizedQuery)) {
|
|
25
|
+
score += 50;
|
|
26
|
+
}
|
|
27
|
+
else if (name.includes(normalizedQuery)) {
|
|
28
|
+
score += 25;
|
|
29
|
+
}
|
|
30
|
+
const haystack = tokenize(`${symbol.module} ${symbol.summary} ${symbol.details ?? ''}`);
|
|
31
|
+
for (const term of terms) {
|
|
32
|
+
score += haystack.filter((t) => t === term).length;
|
|
33
|
+
}
|
|
34
|
+
return { symbol, score };
|
|
35
|
+
})
|
|
36
|
+
.filter(({ score }) => score > 0)
|
|
37
|
+
.sort((a, b) => b.score - a.score)
|
|
38
|
+
.slice(0, limit)
|
|
39
|
+
.map(({ symbol }) => symbol);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../libs/adsp-sdk-mcp-server/src/sdk-reference/search.ts"],"names":[],"mappings":";;AAUA,gDA+BC;AAzCD,2CAA0D;AAE1D,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,KAAa,EAAE,KAAK,GAAG,CAAC;IACzD,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9B,OAAO,yBAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAClC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7B,KAAK,IAAI,GAAG,CAAC;QACf,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YAC5C,KAAK,IAAI,EAAE,CAAC;QACd,CAAC;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC1C,KAAK,IAAI,EAAE,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC;QACxF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QACrD,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC,CAAC;SACC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;SAChC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;SACf,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC"}
|
package/src/server.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
export interface CreateAdspMcpServerOptions {
|
|
3
|
+
/** Root directory of bundled ADSP docs. Defaults to the assets copied alongside the built package. */
|
|
4
|
+
docsRoot?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function createAdspMcpServer(options?: CreateAdspMcpServerOptions): Server;
|