@rekog/mcp-nest 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ZodObject, ZodType } from 'zod';
|
|
2
|
+
import type { GetPromptResult, PromptMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
export type { GetPromptResult, PromptMessage };
|
|
4
|
+
export type PromptResult = GetPromptResult;
|
|
2
5
|
export type PromptArgsRawShape = {
|
|
3
6
|
[k: string]: ZodType;
|
|
4
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.decorator.d.ts","sourceRoot":"","sources":["../../../src/mcp/decorators/prompt.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt.decorator.d.ts","sourceRoot":"","sources":["../../../src/mcp/decorators/prompt.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEzC,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC;AAoB/C,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAE3C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,aAAa,gJAK5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.decorator.js","sourceRoot":"","sources":["../../../src/mcp/decorators/prompt.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAC9D,2CAAsD;AAEtD,+DAA0D;
|
|
1
|
+
{"version":3,"file":"prompt.decorator.js","sourceRoot":"","sources":["../../../src/mcp/decorators/prompt.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAC9D,2CAAsD;AAEtD,+DAA0D;AA4CnD,MAAM,MAAM,GAAG,CAAC,OAAsB,EAAE,EAAE;IAC/C,OAAO,IAAA,wBAAe,EACpB,IAAA,oBAAW,EAAC,mCAAuB,EAAE,OAAO,CAAC,EAC7C,IAAA,uCAAiB,EAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAC1C,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,MAAM,UAKjB","sourcesContent":["import { applyDecorators, SetMetadata } from '@nestjs/common';\nimport { MCP_PROMPT_METADATA_KEY } from './constants';\nimport { ZodObject, ZodType } from 'zod';\nimport { mcpMessagePattern } from './mcp-message-pattern';\nimport type {\n GetPromptResult,\n PromptMessage,\n} from '@modelcontextprotocol/sdk/types.js';\n\nexport type { GetPromptResult, PromptMessage };\n\n/**\n * Return type for an `@Prompt()` handler (return it directly or wrapped in a\n * `Promise`).\n *\n * Annotate your handler with this to get compile-time validation of the shape\n * the MCP SDK enforces at runtime — most usefully, message `role` is\n * `'user' | 'assistant'`\n * runtime failure:\n *\n * ```typescript\n * getGuide(): PromptResult {\n * return {\n * description: '...',\n * messages: [{ role: 'assistant', content: { type: 'text', text: '...' } }],\n * };\n * }\n * ```\n */\nexport type PromptResult = GetPromptResult;\n\nexport type PromptArgsRawShape = {\n [k: string]: ZodType;\n};\n\nexport interface PromptMetadata {\n name: string;\n description: string;\n parameters?: ZodObject<PromptArgsRawShape>;\n}\n\nexport interface PromptOptions {\n name?: string;\n description: string;\n parameters?: ZodObject<PromptArgsRawShape>;\n}\n\nexport const Prompt = (options: PromptOptions) => {\n return applyDecorators(\n SetMetadata(MCP_PROMPT_METADATA_KEY, options),\n mcpMessagePattern('prompt', options.name),\n );\n};\n"]}
|
package/package.json
CHANGED
|
@@ -2,6 +2,32 @@ import { applyDecorators, SetMetadata } from '@nestjs/common';
|
|
|
2
2
|
import { MCP_PROMPT_METADATA_KEY } from './constants';
|
|
3
3
|
import { ZodObject, ZodType } from 'zod';
|
|
4
4
|
import { mcpMessagePattern } from './mcp-message-pattern';
|
|
5
|
+
import type {
|
|
6
|
+
GetPromptResult,
|
|
7
|
+
PromptMessage,
|
|
8
|
+
} from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
|
|
10
|
+
export type { GetPromptResult, PromptMessage };
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Return type for an `@Prompt()` handler (return it directly or wrapped in a
|
|
14
|
+
* `Promise`).
|
|
15
|
+
*
|
|
16
|
+
* Annotate your handler with this to get compile-time validation of the shape
|
|
17
|
+
* the MCP SDK enforces at runtime — most usefully, message `role` is
|
|
18
|
+
* `'user' | 'assistant'`
|
|
19
|
+
* runtime failure:
|
|
20
|
+
*
|
|
21
|
+
* ```typescript
|
|
22
|
+
* getGuide(): PromptResult {
|
|
23
|
+
* return {
|
|
24
|
+
* description: '...',
|
|
25
|
+
* messages: [{ role: 'assistant', content: { type: 'text', text: '...' } }],
|
|
26
|
+
* };
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export type PromptResult = GetPromptResult;
|
|
5
31
|
|
|
6
32
|
export type PromptArgsRawShape = {
|
|
7
33
|
[k: string]: ZodType;
|