@likec4/language-server 1.46.4 → 1.47.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.
Files changed (48) hide show
  1. package/dist/LikeC4LanguageServices.d.ts +27 -21
  2. package/dist/LikeC4LanguageServices.js +24 -14
  3. package/dist/Rpc.js +7 -1
  4. package/dist/ast.d.ts +1 -1
  5. package/dist/browser.d.ts +0 -1
  6. package/dist/browser.js +0 -1
  7. package/dist/bundled.mjs +3769 -3597
  8. package/dist/filesystem/ChokidarWatcher.d.ts +3 -0
  9. package/dist/filesystem/ChokidarWatcher.js +67 -42
  10. package/dist/filesystem/LikeC4FileSystem.d.ts +1 -1
  11. package/dist/filesystem/LikeC4FileSystem.js +16 -6
  12. package/dist/generated/ast.d.ts +2 -2
  13. package/dist/generated/ast.js +1 -1
  14. package/dist/generated/grammar.js +1 -1
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +0 -1
  17. package/dist/lsp/CodeLensProvider.js +1 -1
  18. package/dist/lsp/CompletionProvider.d.ts +4 -2
  19. package/dist/lsp/CompletionProvider.js +41 -3
  20. package/dist/lsp/DocumentSymbolProvider.js +1 -1
  21. package/dist/lsp/SemanticTokenProvider.d.ts +8 -1
  22. package/dist/lsp/SemanticTokenProvider.js +52 -11
  23. package/dist/mcp/interfaces.d.ts +1 -1
  24. package/dist/mcp/interfaces.js +0 -1
  25. package/dist/mcp/server/StreamableLikeC4MCPServer.js +27 -51
  26. package/dist/mcp/tools/_common.d.ts +2 -2
  27. package/dist/mcp/tools/find-relationships.d.ts +195 -5
  28. package/dist/mcp/tools/list-projects.d.ts +191 -3
  29. package/dist/mcp/tools/open-view.d.ts +194 -4
  30. package/dist/mcp/tools/read-deployment.d.ts +194 -4
  31. package/dist/mcp/tools/read-element.d.ts +194 -4
  32. package/dist/mcp/tools/read-project-summary.d.ts +193 -3
  33. package/dist/mcp/tools/read-view.d.ts +194 -4
  34. package/dist/mcp/tools/search-element.d.ts +193 -3
  35. package/dist/model/model-builder.d.ts +4 -2
  36. package/dist/model/model-builder.js +56 -47
  37. package/dist/model/model-parser.d.ts +6 -6
  38. package/dist/model/parser/Base.js +58 -48
  39. package/dist/model/parser/GlobalsParser.d.ts +3 -3
  40. package/dist/model/parser/ViewsParser.js +2 -2
  41. package/dist/protocol.d.ts +5 -0
  42. package/dist/utils/elementRef.js +10 -4
  43. package/dist/validation/index.d.ts +1 -1
  44. package/dist/workspace/LangiumDocuments.d.ts +4 -0
  45. package/dist/workspace/LangiumDocuments.js +11 -5
  46. package/dist/workspace/ProjectsManager.d.ts +4 -0
  47. package/dist/workspace/ProjectsManager.js +89 -84
  48. package/package.json +16 -15
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import { LikeC4FileSystem } from './filesystem/LikeC4FileSystem';
3
3
  import { WithMCPServer } from './mcp/server/WithMCPServer';
4
4
  import { type LikeC4Services, type LikeC4SharedServices } from './module';
5
5
  import { WithLikeC4ManualLayouts } from './views/LikeC4ManualLayouts';
6
- export { getLspConnectionSink, logger as lspLogger } from './logger';
7
6
  export type { DocumentParser, LikeC4ModelBuilder, LikeC4ModelLocator, LikeC4ModelParser } from './model';
8
7
  export type { LikeC4LanguageServices } from './LikeC4LanguageServices';
9
8
  export { isLikeC4Builtin } from './likec4lib';
package/dist/index.js CHANGED
@@ -10,7 +10,6 @@ import { WithMCPServer } from './mcp/server/WithMCPServer';
10
10
  import { createLanguageServices } from './module';
11
11
  import { ConfigurableLayouter } from './views/ConfigurableLayouter';
12
12
  import { WithLikeC4ManualLayouts } from './views/LikeC4ManualLayouts';
13
- export { getLspConnectionSink, logger as lspLogger } from './logger';
14
13
  export { isLikeC4Builtin } from './likec4lib';
15
14
  export { createLanguageServices } from './module';
16
15
  export { LikeC4FileSystem, NoopFileSystem, WithMCPServer };
@@ -11,7 +11,7 @@ export class LikeC4CodeLensProvider {
11
11
  if (!isLikeC4LangiumDocument(doc)) {
12
12
  return;
13
13
  }
14
- if (doc.state <= DocumentState.Linked) {
14
+ if (doc.state < DocumentState.Linked) {
15
15
  logger.debug(`Waiting for document ${doc.uri.path} to be Linked`);
16
16
  await this.services.shared.workspace.DocumentBuilder.waitUntil(DocumentState.Linked, doc.uri, cancelToken);
17
17
  logger.debug(`Document is linked`);
@@ -1,5 +1,5 @@
1
- import { type GrammarAST, type MaybePromise } from 'langium';
2
- import { type CompletionAcceptor, type CompletionContext, DefaultCompletionProvider } from 'langium/lsp';
1
+ import { type MaybePromise, GrammarAST } from 'langium';
2
+ import { type CompletionAcceptor, type CompletionContext, type NextFeature, DefaultCompletionProvider } from 'langium/lsp';
3
3
  import type { LikeC4Services } from '../module';
4
4
  export declare class LikeC4CompletionProvider extends DefaultCompletionProvider {
5
5
  protected services: LikeC4Services;
@@ -7,5 +7,7 @@ export declare class LikeC4CompletionProvider extends DefaultCompletionProvider
7
7
  readonly completionOptions: {
8
8
  triggerCharacters: string[];
9
9
  };
10
+ protected completionFor(context: CompletionContext, next: NextFeature, acceptor: CompletionAcceptor): MaybePromise<void>;
10
11
  protected completionForKeyword(context: CompletionContext, keyword: GrammarAST.Keyword, acceptor: CompletionAcceptor): MaybePromise<void>;
12
+ protected completionForImportedProject(context: CompletionContext, acceptor: CompletionAcceptor): void;
11
13
  }
@@ -1,8 +1,8 @@
1
1
  import { ThemeColors } from '@likec4/core/styles';
2
- import { AstUtils } from 'langium';
2
+ import { AstUtils, GrammarAST } from 'langium';
3
3
  import { DefaultCompletionProvider, } from 'langium/lsp';
4
- import { anyPass } from 'remeda';
5
- import { CompletionItemKind, InsertTextFormat } from 'vscode-languageserver-types';
4
+ import { anyPass, isEmpty } from 'remeda';
5
+ import { CompletionItemKind, InsertTextFormat, TextEdit } from 'vscode-languageserver-types';
6
6
  import { ast } from '../ast';
7
7
  const STYLE_FIELDS = [
8
8
  'color',
@@ -14,6 +14,11 @@ const STYLE_FIELDS = [
14
14
  'size',
15
15
  'textSize',
16
16
  ].join(',');
17
+ function isCompletionForPojectName(context, next) {
18
+ return GrammarAST.isRuleCall(next.feature)
19
+ && next.property === 'project'
20
+ && ast.isImportsFromPoject(context.node);
21
+ }
17
22
  export class LikeC4CompletionProvider extends DefaultCompletionProvider {
18
23
  services;
19
24
  constructor(services) {
@@ -23,6 +28,16 @@ export class LikeC4CompletionProvider extends DefaultCompletionProvider {
23
28
  completionOptions = {
24
29
  triggerCharacters: ['.', '#'],
25
30
  };
31
+ completionFor(context, next, acceptor) {
32
+ switch (true) {
33
+ case GrammarAST.isKeyword(next.feature):
34
+ return this.completionForKeyword(context, next.feature, acceptor);
35
+ case GrammarAST.isCrossReference(next.feature) && !!context.node:
36
+ return this.completionForCrossReference(context, next, acceptor);
37
+ case isCompletionForPojectName(context, next):
38
+ return this.completionForImportedProject(context, acceptor);
39
+ }
40
+ }
26
41
  completionForKeyword(context, keyword, acceptor) {
27
42
  if (!this.filterKeyword(context, keyword)) {
28
43
  return;
@@ -197,4 +212,27 @@ export class LikeC4CompletionProvider extends DefaultCompletionProvider {
197
212
  });
198
213
  }
199
214
  }
215
+ completionForImportedProject(context, acceptor) {
216
+ const projectsManager = this.services.shared.workspace.ProjectsManager;
217
+ const txtDoc = context.document.textDocument;
218
+ const range = {
219
+ start: txtDoc.positionAt(context.tokenOffset),
220
+ end: txtDoc.positionAt(context.tokenEndOffset),
221
+ };
222
+ const txt = txtDoc.getText(range);
223
+ // What is the current character used for quoting
224
+ const currentQuote = isEmpty(txt) ? `'` : txt.substring(0, 1);
225
+ for (const projectId of projectsManager.all) {
226
+ const insertText = currentQuote + projectId + currentQuote;
227
+ acceptor(context, {
228
+ label: projectId,
229
+ kind: CompletionItemKind.Folder,
230
+ insertText,
231
+ filterText: insertText,
232
+ textEdit: TextEdit.replace(range, insertText),
233
+ detail: 'Project',
234
+ sortText: '0_' + projectId,
235
+ });
236
+ }
237
+ }
200
238
  }
@@ -29,7 +29,7 @@ export class LikeC4DocumentSymbolProvider {
29
29
  if (!isLikeC4LangiumDocument(doc) || this.services.shared.workspace.ProjectsManager.isExcluded(doc)) {
30
30
  return [];
31
31
  }
32
- if (doc.state <= DocumentState.Linked) {
32
+ if (doc.state < DocumentState.Linked) {
33
33
  logger.debug(`Waiting for document ${doc.uri.path} to be Linked`);
34
34
  await this.services.shared.workspace.DocumentBuilder.waitUntil(DocumentState.Linked, doc.uri, cancelToken);
35
35
  logger.debug(`document is Linked`);
@@ -1,10 +1,17 @@
1
- import type { AstNode } from 'langium';
1
+ import { type AstNode, type LangiumDocument } from 'langium';
2
2
  import { type SemanticTokenAcceptor, AbstractSemanticTokenProvider } from 'langium/lsp';
3
+ import { type SemanticTokensDeltaParams, type SemanticTokensParams, type SemanticTokensRangeParams, CancellationToken } from 'vscode-languageserver-protocol';
4
+ import { type SemanticTokens, type SemanticTokensDelta } from 'vscode-languageserver-types';
3
5
  import type { LikeC4Services } from '../module';
4
6
  export declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
7
+ protected services: LikeC4Services;
5
8
  private rules;
6
9
  constructor(services: LikeC4Services);
7
10
  protected initRules(): void;
11
+ semanticHighlight(document: LangiumDocument, params: SemanticTokensParams, cancelToken?: CancellationToken): Promise<SemanticTokens>;
12
+ semanticHighlightRange(document: LangiumDocument, params: SemanticTokensRangeParams, cancelToken?: CancellationToken): Promise<SemanticTokens>;
13
+ semanticHighlightDelta(document: LangiumDocument, params: SemanticTokensDeltaParams, cancelToken?: CancellationToken): Promise<SemanticTokens | SemanticTokensDelta>;
14
+ protected ensureState(document: LangiumDocument, cancelToken: CancellationToken): Promise<void>;
8
15
  protected highlightElement(node: AstNode, acceptor: SemanticTokenAcceptor): void | undefined | 'prune';
9
16
  private highlightNameAndKind;
10
17
  private highlightView;
@@ -1,9 +1,12 @@
1
1
  import { isAnyOf, nonNullable } from '@likec4/core/utils';
2
+ import { DocumentState } from 'langium';
2
3
  import { AbstractSemanticTokenProvider, } from 'langium/lsp';
3
4
  import { isTruthy } from 'remeda';
4
- import { SemanticTokenModifiers, SemanticTokenTypes } from 'vscode-languageserver-types';
5
+ import { CancellationToken, } from 'vscode-languageserver-protocol';
6
+ import { SemanticTokenModifiers, SemanticTokenTypes, } from 'vscode-languageserver-types';
5
7
  import { ast } from '../ast';
6
- import { logger } from '../logger';
8
+ import { logger as rootLogger } from '../logger';
9
+ const logger = rootLogger.getChild('SemanticTokenProvider');
7
10
  const SemanticTypes = { ...SemanticTokenTypes };
8
11
  const SemanticModifiers = { ...SemanticTokenModifiers };
9
12
  function createSemanticTypeMethods(applyHighlight) {
@@ -36,9 +39,11 @@ const stopHighlight = () => {
36
39
  throw PRUNE;
37
40
  };
38
41
  export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
42
+ services;
39
43
  rules = [];
40
44
  constructor(services) {
41
45
  super(services);
46
+ this.services = services;
42
47
  this.initRules();
43
48
  }
44
49
  initRules() {
@@ -61,10 +66,21 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
61
66
  mark.property('value').readonly.definition.interface();
62
67
  stopHighlight();
63
68
  });
64
- when(isAnyOf(ast.isFqnRefExpr, ast.isWildcardExpression), mark => {
69
+ when(ast.isWildcardExpression, mark => {
65
70
  mark.cst().readonly.definition.variable();
66
71
  stopHighlight();
67
72
  });
73
+ when(ast.isFqnRefExpr, mark => {
74
+ if (!mark.node.selector) {
75
+ return;
76
+ }
77
+ if (mark.node.ref.parent) {
78
+ mark.property('selector').property();
79
+ }
80
+ else {
81
+ mark.property('selector').readonly.definition.variable();
82
+ }
83
+ });
68
84
  when(ast.isTagRef, mark => {
69
85
  mark.cst().type();
70
86
  stopHighlight();
@@ -109,22 +125,22 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
109
125
  }
110
126
  });
111
127
  when(isAnyOf(ast.isFqnRef, ast.isStrictFqnRef), mark => {
112
- const text = mark.node.$cstNode?.text ?? '';
113
- if (text !== '' && text !== 'this' && text !== 'it') {
114
- mark.property('value').readonly.definition.variable();
115
- }
116
128
  if (!mark.node.parent) {
129
+ mark.property('value').readonly.definition.variable();
117
130
  stopHighlight();
118
131
  }
132
+ else {
133
+ mark.property('value').property();
134
+ }
119
135
  });
120
136
  when(ast.isStrictFqnElementRef, mark => {
121
- const text = mark.node.el.$refText ?? '';
122
- if (text !== '') {
123
- mark.property('el').readonly.definition.variable();
124
- }
125
137
  if (!mark.node.parent) {
138
+ mark.property('el').readonly.definition.variable();
126
139
  stopHighlight();
127
140
  }
141
+ else {
142
+ mark.property('el').property();
143
+ }
128
144
  });
129
145
  when(ast.isSpecificationColor, mark => {
130
146
  mark.keyword('color').keyword();
@@ -170,6 +186,31 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
170
186
  }
171
187
  });
172
188
  }
189
+ async semanticHighlight(document, params, cancelToken = CancellationToken.None) {
190
+ if (document.state < DocumentState.Linked) {
191
+ await this.ensureState(document, cancelToken);
192
+ }
193
+ return await super.semanticHighlight(document, params, cancelToken);
194
+ }
195
+ async semanticHighlightRange(document, params, cancelToken = CancellationToken.None) {
196
+ if (document.state < DocumentState.Linked) {
197
+ await this.ensureState(document, cancelToken);
198
+ }
199
+ return await super.semanticHighlightRange(document, params, cancelToken);
200
+ }
201
+ async semanticHighlightDelta(document, params, cancelToken = CancellationToken.None) {
202
+ if (document.state < DocumentState.Linked) {
203
+ await this.ensureState(document, cancelToken);
204
+ }
205
+ return await super.semanticHighlightDelta(document, params, cancelToken);
206
+ }
207
+ async ensureState(document, cancelToken) {
208
+ if (document.state < DocumentState.Linked) {
209
+ logger.debug `waiting for document ${document.uri.path} to be ${'Linked'}`;
210
+ await this.services.shared.workspace.DocumentBuilder.waitUntil(DocumentState.Linked, document.uri, cancelToken);
211
+ logger.debug `document ${document.uri.path} is ${'Linked'}`;
212
+ }
213
+ }
173
214
  highlightElement(node, acceptor) {
174
215
  if (isAnyOf(ast.isElement, ast.isDeploymentNode, ast.isDeployedInstance)(node)) {
175
216
  return this.highlightNameAndKind(node);
@@ -1,4 +1,4 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { LikeC4Services } from '../module';
3
3
  export interface LikeC4MCPServer {
4
4
  readonly mcp: McpServer;
@@ -1,4 +1,3 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
1
  import { NoopLikeC4MCPServer } from './NoopLikeC4MCPServer';
3
2
  export const NoMCPServer = {
4
3
  mcpServer: () => new NoopLikeC4MCPServer(),
@@ -1,53 +1,27 @@
1
1
  import { serve } from '@hono/node-server';
2
2
  import { loggable } from '@likec4/log';
3
- import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
4
- import { toFetchResponse, toReqRes } from 'fetch-to-node';
3
+ import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
5
4
  import { Hono } from 'hono';
5
+ import { cors } from 'hono/cors';
6
+ import { nanoid } from 'nanoid';
6
7
  import { logger } from '../utils';
7
- function createHonoApp(factory) {
8
- return new Hono()
9
- .post('/mcp', async (c) => {
10
- const { req, res } = toReqRes(c.req.raw);
11
- const mcp = factory.create();
12
- try {
13
- const transport = new StreamableHTTPServerTransport({
14
- sessionIdGenerator: undefined,
15
- });
16
- // Added for extra debuggability
17
- transport.onerror = (err) => {
18
- logger.error(loggable(err));
19
- };
20
- await mcp.connect(transport);
21
- await transport.handleRequest(req, res, await c.req.json());
22
- res.on('close', async () => {
23
- await transport.close();
24
- await mcp.close();
25
- });
26
- return toFetchResponse(res);
27
- }
28
- catch (e) {
29
- logger.error(loggable(e));
30
- return c.json({
31
- jsonrpc: '2.0',
32
- error: {
33
- code: -32603,
34
- message: 'Internal server error',
35
- },
36
- id: null,
37
- }, { status: 500 });
38
- }
39
- })
40
- .all('/mcp', async (c) => {
41
- return c.json({
42
- jsonrpc: '2.0',
43
- error: {
44
- code: -32000,
45
- message: 'Method not allowed.',
46
- },
47
- id: null,
48
- }, { status: 405 });
49
- })
50
- .notFound((c) => {
8
+ async function createHonoApp(factory) {
9
+ const mcp = factory.create();
10
+ const transport = new WebStandardStreamableHTTPServerTransport({
11
+ sessionIdGenerator: () => nanoid(),
12
+ });
13
+ const app = new Hono();
14
+ // Enable CORS for all origins
15
+ app.use('*', cors({
16
+ origin: '*',
17
+ allowHeaders: ['Content-Type', 'mcp-session-id', 'Last-Event-ID', 'mcp-protocol-version'],
18
+ exposeHeaders: ['mcp-session-id', 'mcp-protocol-version'],
19
+ }));
20
+ // Health check endpoint
21
+ app.get('/health', c => c.json({ status: 'ok' }));
22
+ // MCP endpoint
23
+ app.all('/mcp', c => transport.handleRequest(c.req.raw));
24
+ app.notFound((c) => {
51
25
  logger.debug(`${c.req.method} ${c.req.url} not found`);
52
26
  return c.json({
53
27
  jsonrpc: '2.0',
@@ -57,8 +31,8 @@ function createHonoApp(factory) {
57
31
  },
58
32
  id: null,
59
33
  }, { status: 404 });
60
- })
61
- .onError((e, c) => {
34
+ });
35
+ app.onError((e, c) => {
62
36
  logger.error(loggable(e));
63
37
  return c.json({
64
38
  jsonrpc: '2.0',
@@ -69,11 +43,13 @@ function createHonoApp(factory) {
69
43
  id: null,
70
44
  }, { status: 500 });
71
45
  });
46
+ await mcp.connect(transport);
47
+ return app;
72
48
  }
73
- function startServer(params) {
49
+ async function startServer(params) {
50
+ const { factory, port } = params;
51
+ const app = await createHonoApp(factory);
74
52
  return new Promise((resolve, reject) => {
75
- const { factory, port } = params;
76
- const app = createHonoApp(factory);
77
53
  const server = serve({
78
54
  fetch: app.fetch,
79
55
  hostname: '0.0.0.0',
@@ -76,13 +76,13 @@ export declare const includedInViewsSchema: z.ZodArray<z.ZodObject<{
76
76
  title: z.ZodString;
77
77
  type: z.ZodEnum<["element", "deployment", "dynamic"]>;
78
78
  }, "strip", z.ZodTypeAny, {
79
+ type: "element" | "deployment" | "dynamic";
79
80
  id: string;
80
81
  title: string;
81
- type: "deployment" | "element" | "dynamic";
82
82
  }, {
83
+ type: "element" | "deployment" | "dynamic";
83
84
  id: string;
84
85
  title: string;
85
- type: "deployment" | "element" | "dynamic";
86
86
  }>, "many">;
87
87
  export declare const includedInViews: (views: Iterable<LikeC4ViewModel>) => z.infer<typeof includedInViewsSchema>;
88
88
  export declare const mkLocate: (languageServices: LikeC4LanguageServices, projectId: string) => (params: Locate.Params) => z.infer<typeof locationSchema>;
@@ -5,8 +5,198 @@ export declare const findRelationships: (languageServices: import("../..").LikeC
5
5
  element2: z.ZodString;
6
6
  project: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, import("@likec4/core").ProjectId, string>>>;
7
7
  };
8
- }, (args: {
9
- project: string & import("type-fest/source/tagged").Tag<"ProjectID", never>;
10
- element1: string;
11
- element2: string;
12
- }, extra: import("@modelcontextprotocol/sdk/shared/protocol.js").RequestHandlerExtra<import("@modelcontextprotocol/sdk/types.js").ServerRequest, import("@modelcontextprotocol/sdk/types.js").ServerNotification>) => import("@modelcontextprotocol/sdk/types.js").CallToolResult | Promise<import("@modelcontextprotocol/sdk/types.js").CallToolResult>];
8
+ }, (args: import("@modelcontextprotocol/sdk/server/zod-compat.js").ShapeOutput<{
9
+ element1: z.ZodString;
10
+ element2: z.ZodString;
11
+ project: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodString, import("@likec4/core").ProjectId, string>>>;
12
+ }>, extra: import("@modelcontextprotocol/sdk/shared/protocol.js").RequestHandlerExtra<import("@modelcontextprotocol/sdk/types.js").ServerRequest, import("@modelcontextprotocol/sdk/types.js").ServerNotification>) => {
13
+ [x: string]: unknown;
14
+ content: ({
15
+ type: "text";
16
+ text: string;
17
+ annotations?: {
18
+ audience?: ("user" | "assistant")[] | undefined;
19
+ priority?: number | undefined;
20
+ lastModified?: string | undefined;
21
+ } | undefined;
22
+ _meta?: {
23
+ [x: string]: unknown;
24
+ } | undefined;
25
+ } | {
26
+ type: "image";
27
+ data: string;
28
+ mimeType: string;
29
+ annotations?: {
30
+ audience?: ("user" | "assistant")[] | undefined;
31
+ priority?: number | undefined;
32
+ lastModified?: string | undefined;
33
+ } | undefined;
34
+ _meta?: {
35
+ [x: string]: unknown;
36
+ } | undefined;
37
+ } | {
38
+ type: "audio";
39
+ data: string;
40
+ mimeType: string;
41
+ annotations?: {
42
+ audience?: ("user" | "assistant")[] | undefined;
43
+ priority?: number | undefined;
44
+ lastModified?: string | undefined;
45
+ } | undefined;
46
+ _meta?: {
47
+ [x: string]: unknown;
48
+ } | undefined;
49
+ } | {
50
+ uri: string;
51
+ name: string;
52
+ type: "resource_link";
53
+ description?: string | undefined;
54
+ mimeType?: string | undefined;
55
+ annotations?: {
56
+ audience?: ("user" | "assistant")[] | undefined;
57
+ priority?: number | undefined;
58
+ lastModified?: string | undefined;
59
+ } | undefined;
60
+ _meta?: {
61
+ [x: string]: unknown;
62
+ } | undefined;
63
+ icons?: {
64
+ src: string;
65
+ mimeType?: string | undefined;
66
+ sizes?: string[] | undefined;
67
+ theme?: "light" | "dark" | undefined;
68
+ }[] | undefined;
69
+ title?: string | undefined;
70
+ } | {
71
+ type: "resource";
72
+ resource: {
73
+ uri: string;
74
+ text: string;
75
+ mimeType?: string | undefined;
76
+ _meta?: {
77
+ [x: string]: unknown;
78
+ } | undefined;
79
+ } | {
80
+ uri: string;
81
+ blob: string;
82
+ mimeType?: string | undefined;
83
+ _meta?: {
84
+ [x: string]: unknown;
85
+ } | undefined;
86
+ };
87
+ annotations?: {
88
+ audience?: ("user" | "assistant")[] | undefined;
89
+ priority?: number | undefined;
90
+ lastModified?: string | undefined;
91
+ } | undefined;
92
+ _meta?: {
93
+ [x: string]: unknown;
94
+ } | undefined;
95
+ })[];
96
+ _meta?: {
97
+ [x: string]: unknown;
98
+ progressToken?: string | number | undefined;
99
+ "io.modelcontextprotocol/related-task"?: {
100
+ taskId: string;
101
+ } | undefined;
102
+ } | undefined;
103
+ structuredContent?: {
104
+ [x: string]: unknown;
105
+ } | undefined;
106
+ isError?: boolean | undefined;
107
+ } | Promise<{
108
+ [x: string]: unknown;
109
+ content: ({
110
+ type: "text";
111
+ text: string;
112
+ annotations?: {
113
+ audience?: ("user" | "assistant")[] | undefined;
114
+ priority?: number | undefined;
115
+ lastModified?: string | undefined;
116
+ } | undefined;
117
+ _meta?: {
118
+ [x: string]: unknown;
119
+ } | undefined;
120
+ } | {
121
+ type: "image";
122
+ data: string;
123
+ mimeType: string;
124
+ annotations?: {
125
+ audience?: ("user" | "assistant")[] | undefined;
126
+ priority?: number | undefined;
127
+ lastModified?: string | undefined;
128
+ } | undefined;
129
+ _meta?: {
130
+ [x: string]: unknown;
131
+ } | undefined;
132
+ } | {
133
+ type: "audio";
134
+ data: string;
135
+ mimeType: string;
136
+ annotations?: {
137
+ audience?: ("user" | "assistant")[] | undefined;
138
+ priority?: number | undefined;
139
+ lastModified?: string | undefined;
140
+ } | undefined;
141
+ _meta?: {
142
+ [x: string]: unknown;
143
+ } | undefined;
144
+ } | {
145
+ uri: string;
146
+ name: string;
147
+ type: "resource_link";
148
+ description?: string | undefined;
149
+ mimeType?: string | undefined;
150
+ annotations?: {
151
+ audience?: ("user" | "assistant")[] | undefined;
152
+ priority?: number | undefined;
153
+ lastModified?: string | undefined;
154
+ } | undefined;
155
+ _meta?: {
156
+ [x: string]: unknown;
157
+ } | undefined;
158
+ icons?: {
159
+ src: string;
160
+ mimeType?: string | undefined;
161
+ sizes?: string[] | undefined;
162
+ theme?: "light" | "dark" | undefined;
163
+ }[] | undefined;
164
+ title?: string | undefined;
165
+ } | {
166
+ type: "resource";
167
+ resource: {
168
+ uri: string;
169
+ text: string;
170
+ mimeType?: string | undefined;
171
+ _meta?: {
172
+ [x: string]: unknown;
173
+ } | undefined;
174
+ } | {
175
+ uri: string;
176
+ blob: string;
177
+ mimeType?: string | undefined;
178
+ _meta?: {
179
+ [x: string]: unknown;
180
+ } | undefined;
181
+ };
182
+ annotations?: {
183
+ audience?: ("user" | "assistant")[] | undefined;
184
+ priority?: number | undefined;
185
+ lastModified?: string | undefined;
186
+ } | undefined;
187
+ _meta?: {
188
+ [x: string]: unknown;
189
+ } | undefined;
190
+ })[];
191
+ _meta?: {
192
+ [x: string]: unknown;
193
+ progressToken?: string | number | undefined;
194
+ "io.modelcontextprotocol/related-task"?: {
195
+ taskId: string;
196
+ } | undefined;
197
+ } | undefined;
198
+ structuredContent?: {
199
+ [x: string]: unknown;
200
+ } | undefined;
201
+ isError?: boolean | undefined;
202
+ }>];