@agentailor/create-mcp-server 0.7.1 → 0.8.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 (53) hide show
  1. package/README.md +27 -3
  2. package/dist/assets/skills/tool-design/SKILL.md +107 -0
  3. package/dist/assets/skills/tool-design/references/examples.md +273 -0
  4. package/dist/assets/skills/tool-design/references/principles.md +261 -0
  5. package/dist/assets/skills/tool-design/references/testing.md +195 -0
  6. package/dist/cli.d.ts +1 -0
  7. package/dist/cli.js +4 -2
  8. package/dist/cli.test.js +19 -0
  9. package/dist/index.js +1 -0
  10. package/dist/interactive.js +8 -0
  11. package/dist/project-generator.d.ts +1 -0
  12. package/dist/project-generator.js +27 -4
  13. package/dist/skills.d.ts +43 -0
  14. package/dist/skills.js +64 -0
  15. package/dist/skills.test.d.ts +1 -0
  16. package/dist/skills.test.js +85 -0
  17. package/dist/templates/common/agents.md.d.ts +9 -0
  18. package/dist/templates/common/agents.md.js +221 -0
  19. package/dist/templates/common/agents.md.test.d.ts +1 -0
  20. package/dist/templates/common/agents.md.test.js +142 -0
  21. package/dist/templates/common/package.json.js +19 -8
  22. package/dist/templates/common/tsconfig.json.d.ts +3 -1
  23. package/dist/templates/common/tsconfig.json.js +8 -2
  24. package/dist/templates/fastmcp/index.js +5 -3
  25. package/dist/templates/fastmcp/readme.js +13 -0
  26. package/dist/templates/sdk/stateful/auth.js +5 -1
  27. package/dist/templates/sdk/stateful/auth.test.js +6 -2
  28. package/dist/templates/sdk/stateful/index.d.ts +6 -0
  29. package/dist/templates/sdk/stateful/index.js +7 -1
  30. package/dist/templates/sdk/stateful/readme.js +1 -1
  31. package/dist/templates/sdk/stateful/templates.test.js +6 -7
  32. package/dist/templates/sdk/stateless/index.d.ts +6 -0
  33. package/dist/templates/sdk/stateless/index.js +10 -1
  34. package/dist/templates/sdk/stateless/prompts.d.ts +1 -0
  35. package/dist/templates/sdk/stateless/prompts.js +32 -0
  36. package/dist/templates/sdk/stateless/readme.js +72 -13
  37. package/dist/templates/sdk/stateless/resources.d.ts +1 -0
  38. package/dist/templates/sdk/stateless/resources.js +49 -0
  39. package/dist/templates/sdk/stateless/server-test.d.ts +1 -0
  40. package/dist/templates/sdk/stateless/server-test.js +175 -0
  41. package/dist/templates/sdk/stateless/server.js +14 -68
  42. package/dist/templates/sdk/stateless/store-test.d.ts +1 -0
  43. package/dist/templates/sdk/stateless/store-test.js +38 -0
  44. package/dist/templates/sdk/stateless/store.d.ts +1 -0
  45. package/dist/templates/sdk/stateless/store.js +107 -0
  46. package/dist/templates/sdk/stateless/templates.test.js +160 -14
  47. package/dist/templates/sdk/stateless/tools.d.ts +1 -0
  48. package/dist/templates/sdk/stateless/tools.js +172 -0
  49. package/dist/templates/sdk/stdio/index.d.ts +6 -0
  50. package/dist/templates/sdk/stdio/index.js +6 -0
  51. package/dist/templates/sdk/stdio/readme.js +64 -11
  52. package/dist/templates/sdk/stdio/templates.test.js +11 -13
  53. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ export declare function getStoreTestTemplate(): string;
@@ -0,0 +1,38 @@
1
+ export function getStoreTestTemplate() {
2
+ return `import { describe, it, expect, beforeEach } from 'vitest';
3
+ import * as notes from './notes-store.js';
4
+
5
+ // The store has no MCP imports, so these run without a server or a transport.
6
+ // Only two tests live here, and both exist because a tool contract depends on
7
+ // them - the rest of the store is ordinary code that needs no demonstration.
8
+
9
+ describe('notes-store', () => {
10
+ beforeEach(() => {
11
+ notes.seedForTests([]);
12
+ });
13
+
14
+ it('reports the full match count, not the size of the page', () => {
15
+ // list_notes can only say "showing 5 of 30" because the store reports both.
16
+ // A store that returned rows.length as the total would make every truncated
17
+ // result look complete - the tool would lie without anything failing.
18
+ for (let i = 0; i < 30; i++) {
19
+ notes.create({ title: 'note ' + i, body: '' });
20
+ }
21
+
22
+ const result = notes.list({ limit: 5 });
23
+
24
+ expect(result.rows).toHaveLength(5);
25
+ expect(result.total).toBe(30);
26
+ });
27
+
28
+ it('distinguishes an unknown tag from a tag with no notes', () => {
29
+ // Both would otherwise return an empty list, and the agent would report
30
+ // "you have no notes" when the truth is "that tag does not exist".
31
+ notes.create({ title: 'tagged', body: '', tags: ['release'] });
32
+
33
+ expect(() => notes.list({ tag: 'nope', limit: 10 })).toThrow(notes.UnknownTagError);
34
+ expect(notes.list({ tag: 'release', limit: 10 }).total).toBe(1);
35
+ });
36
+ });
37
+ `;
38
+ }
@@ -0,0 +1 @@
1
+ export declare function getStoreTemplate(): string;
@@ -0,0 +1,107 @@
1
+ export function getStoreTemplate() {
2
+ return `// Domain logic, deliberately free of MCP imports.
3
+ //
4
+ // This module is imported once, so the notes live for the lifetime of the
5
+ // process. That matters: the MCP server factory runs once per request, so
6
+ // anything stored on the server instance would be discarded between calls and
7
+ // notes_create would never be visible to a later notes_list.
8
+ //
9
+ // Replace this with your own data layer. Keep the seam: tools stay thin, the
10
+ // logic stays testable without a transport.
11
+
12
+ export interface Note {
13
+ id: string;
14
+ title: string;
15
+ body: string;
16
+ tags: string[];
17
+ createdAt: string;
18
+ }
19
+
20
+ export interface ListResult {
21
+ /** The page of notes, capped by \`limit\`. */
22
+ rows: Note[];
23
+ /** How many notes matched the filter in total, before the cap was applied. */
24
+ total: number;
25
+ }
26
+
27
+ export class UnknownTagError extends Error {
28
+ constructor(readonly tag: string) {
29
+ super(\`Unknown tag: \${tag}\`);
30
+ this.name = 'UnknownTagError';
31
+ }
32
+ }
33
+
34
+ export const MAX_TITLE_LENGTH = 120;
35
+
36
+ const notes = new Map<string, Note>();
37
+
38
+ let counter = 0;
39
+
40
+ function nextId(): string {
41
+ counter += 1;
42
+ return \`note_\${counter.toString(16).padStart(8, '0')}\`;
43
+ }
44
+
45
+ /** Every tag currently in use, so callers can tell a typo from an empty result. */
46
+ export function knownTags(): string[] {
47
+ const tags = new Set<string>();
48
+ for (const note of notes.values()) {
49
+ for (const tag of note.tags) tags.add(tag);
50
+ }
51
+ return [...tags].sort();
52
+ }
53
+
54
+ /**
55
+ * Returns a page of notes plus the unfiltered match count.
56
+ *
57
+ * \`total\` is the number of matches, not the number returned - the caller needs
58
+ * both to tell the agent honestly that a result was truncated.
59
+ */
60
+ export function list(options: { tag?: string; limit: number }): ListResult {
61
+ const { tag, limit } = options;
62
+
63
+ if (tag !== undefined && !knownTags().includes(tag)) {
64
+ throw new UnknownTagError(tag);
65
+ }
66
+
67
+ const matches = [...notes.values()]
68
+ .filter((note) => tag === undefined || note.tags.includes(tag))
69
+ .sort((a, b) => b.createdAt.localeCompare(a.createdAt));
70
+
71
+ return { rows: matches.slice(0, limit), total: matches.length };
72
+ }
73
+
74
+ export function get(id: string): Note | undefined {
75
+ return notes.get(id);
76
+ }
77
+
78
+ export function create(input: { title: string; body: string; tags?: string[] }): Note {
79
+ const title = input.title.trim();
80
+
81
+ if (title.length === 0) {
82
+ throw new RangeError('title must not be empty');
83
+ }
84
+ if (title.length > MAX_TITLE_LENGTH) {
85
+ throw new RangeError(\`title must be \${MAX_TITLE_LENGTH} characters or fewer\`);
86
+ }
87
+
88
+ const note: Note = {
89
+ id: nextId(),
90
+ title,
91
+ body: input.body,
92
+ tags: input.tags ?? [],
93
+ createdAt: new Date().toISOString(),
94
+ };
95
+
96
+ notes.set(note.id, note);
97
+ return note;
98
+ }
99
+
100
+ /** Test helper: replaces all notes. Not part of the tool surface. */
101
+ export function seedForTests(seed: Note[]): void {
102
+ notes.clear();
103
+ counter = 0;
104
+ for (const note of seed) notes.set(note.id, note);
105
+ }
106
+ `;
107
+ }
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { getServerTemplate, getIndexTemplate, getReadmeTemplate } from './index.js';
2
+ import { getServerTemplate, getIndexTemplate, getReadmeTemplate, getStoreTemplate, getToolsTemplate, getPromptsTemplate, getResourcesTemplate, getStoreTestTemplate, getServerTestTemplate, } from './index.js';
3
3
  describe('sdk/stateless templates', () => {
4
4
  const projectName = 'test-project';
5
5
  describe('getServerTemplate', () => {
@@ -15,30 +15,101 @@ describe('sdk/stateless templates', () => {
15
15
  const template = getServerTemplate(projectName);
16
16
  expect(template).not.toContain('@modelcontextprotocol/sdk');
17
17
  });
18
- it('should include example prompt', () => {
18
+ it('should compose the primitives rather than defining them inline', () => {
19
19
  const template = getServerTemplate(projectName);
20
- expect(template).toContain('greeting-template');
21
- expect(template).toContain('registerPrompt');
20
+ expect(template).toContain("import { registerTools } from './tools.js'");
21
+ expect(template).toContain("import { registerPrompts } from './prompts.js'");
22
+ expect(template).toContain("import { registerResources } from './resources.js'");
23
+ expect(template).toContain('registerTools(server)');
24
+ expect(template).toContain('registerPrompts(server)');
25
+ expect(template).toContain('registerResources(server)');
22
26
  });
23
- it('should include example tool', () => {
27
+ it('should not register primitives directly', () => {
24
28
  const template = getServerTemplate(projectName);
25
- expect(template).toContain('greet');
29
+ expect(template).not.toContain('server.registerTool(');
30
+ expect(template).not.toContain('server.registerPrompt(');
31
+ expect(template).not.toContain('server.registerResource(');
32
+ });
33
+ it('should not use the deprecated logging subsystem', () => {
34
+ const template = getServerTemplate(projectName);
35
+ expect(template).not.toContain('sendLoggingMessage');
36
+ expect(template).not.toContain('capabilities: { logging: {} }');
37
+ });
38
+ });
39
+ describe('getToolsTemplate', () => {
40
+ it('should register the notes tools', () => {
41
+ const template = getToolsTemplate();
26
42
  expect(template).toContain('registerTool');
43
+ expect(template).toContain("'list_notes'");
44
+ expect(template).toContain("'get_note'");
45
+ expect(template).toContain("'create_note'");
46
+ });
47
+ // Most MCP clients prepend the server name, so a hardcoded prefix would
48
+ // surface as "my-server_notes_list".
49
+ it('should not hardcode a server namespace into tool names', () => {
50
+ const template = getToolsTemplate();
51
+ expect(template).not.toContain("'notes_list'");
52
+ expect(template).not.toContain("'notes_get'");
53
+ expect(template).not.toContain("'notes_create'");
54
+ });
55
+ it('should read its data from the store module', () => {
56
+ const template = getToolsTemplate();
57
+ expect(template).toContain("import * as notes from './notes-store.js'");
27
58
  });
28
59
  it('should declare schemas as Standard Schema via z.object', () => {
29
- const template = getServerTemplate(projectName);
60
+ const template = getToolsTemplate();
30
61
  expect(template).toContain('inputSchema: z.object(');
62
+ });
63
+ it('should signal truncation rather than silently capping', () => {
64
+ const template = getToolsTemplate();
65
+ expect(template).toContain('truncated');
66
+ expect(template).toContain('matched');
67
+ expect(template).toContain('hint');
68
+ expect(template).toContain('DEFAULT_LIMIT');
69
+ });
70
+ it('should distinguish an unknown tag from a tag with no notes', () => {
71
+ const template = getToolsTemplate();
72
+ expect(template).toContain('UnknownTagError');
73
+ expect(template).toContain('knownTags');
74
+ });
75
+ it('should return actionable errors as isError, not thrown exceptions', () => {
76
+ const template = getToolsTemplate();
77
+ expect(template).toContain('isError: true');
78
+ expect(template).toContain('function toolError');
79
+ });
80
+ it('should point the agent at the sibling tool by its real name', () => {
81
+ const template = getToolsTemplate();
82
+ expect(template).toContain('Call list_notes');
83
+ });
84
+ });
85
+ describe('getPromptsTemplate', () => {
86
+ it('should register the example prompt', () => {
87
+ const template = getPromptsTemplate();
88
+ expect(template).toContain('registerPrompt');
89
+ expect(template).toContain('summarize-notes');
31
90
  expect(template).toContain('argsSchema: z.object(');
32
91
  });
33
- it('should not use the deprecated logging subsystem', () => {
34
- const template = getServerTemplate(projectName);
35
- expect(template).not.toContain('sendLoggingMessage');
36
- expect(template).not.toContain('capabilities: { logging: {} }');
92
+ it('should reference the tool by its unprefixed name', () => {
93
+ const template = getPromptsTemplate();
94
+ expect(template).toContain('list_notes');
95
+ expect(template).not.toContain('notes_list');
37
96
  });
38
- it('should include example resource', () => {
39
- const template = getServerTemplate(projectName);
40
- expect(template).toContain('greeting-resource');
97
+ });
98
+ describe('getResourcesTemplate', () => {
99
+ it('should register a resource template for a single note', () => {
100
+ const template = getResourcesTemplate();
41
101
  expect(template).toContain('registerResource');
102
+ expect(template).toContain("new ResourceTemplate('notes://{id}'");
103
+ });
104
+ // The v2 type declares `list` as required (not optional), so omitting it
105
+ // fails tsc with TS2741 in the generated project.
106
+ it('should pass list to ResourceTemplate', () => {
107
+ const template = getResourcesTemplate();
108
+ expect(template).toContain('list: async ()');
109
+ });
110
+ it('should read its data from the store module', () => {
111
+ const template = getResourcesTemplate();
112
+ expect(template).toContain("import * as notes from './notes-store.js'");
42
113
  });
43
114
  });
44
115
  describe('getIndexTemplate', () => {
@@ -138,4 +209,79 @@ describe('sdk/stateless templates', () => {
138
209
  expect(template).not.toContain('npm run');
139
210
  });
140
211
  });
212
+ describe('getStoreTemplate', () => {
213
+ it('should not import anything from the MCP SDK', () => {
214
+ const template = getStoreTemplate();
215
+ expect(template).not.toContain('@modelcontextprotocol');
216
+ });
217
+ it('should hold notes at module scope, not per call', () => {
218
+ const template = getStoreTemplate();
219
+ // The MCP server factory runs once per request; state kept on the server
220
+ // would be discarded between calls.
221
+ expect(template).toContain('const notes = new Map<string, Note>()');
222
+ });
223
+ it('should return the unfiltered total alongside the page', () => {
224
+ const template = getStoreTemplate();
225
+ // Callers need both to report truncation honestly.
226
+ expect(template).toContain('rows: Note[]');
227
+ expect(template).toContain('total: number');
228
+ expect(template).toContain('total: matches.length');
229
+ });
230
+ it('should expose the tags in use so callers can detect a typo', () => {
231
+ const template = getStoreTemplate();
232
+ expect(template).toContain('export function knownTags()');
233
+ expect(template).toContain('UnknownTagError');
234
+ });
235
+ it('should validate the title against a documented bound', () => {
236
+ const template = getStoreTemplate();
237
+ expect(template).toContain('MAX_TITLE_LENGTH');
238
+ expect(template).toContain('RangeError');
239
+ });
240
+ it('should provide a seam for seeding in tests', () => {
241
+ const template = getStoreTemplate();
242
+ expect(template).toContain('export function seedForTests(');
243
+ });
244
+ });
245
+ describe('generated test templates', () => {
246
+ it('should exercise the store without a transport', () => {
247
+ const template = getStoreTestTemplate();
248
+ expect(template).toContain("import * as notes from './notes-store.js'");
249
+ expect(template).not.toContain('@modelcontextprotocol/client');
250
+ expect(template).not.toContain('InMemoryTransport');
251
+ });
252
+ it('should pin the store invariants the tools depend on', () => {
253
+ const template = getStoreTestTemplate();
254
+ expect(template).toContain('reports the full match count');
255
+ expect(template).toContain('distinguishes an unknown tag from a tag with no notes');
256
+ expect(template).toContain('seedForTests');
257
+ });
258
+ it('should drive the server through a real client', () => {
259
+ const template = getServerTestTemplate();
260
+ expect(template).toContain("import { Client } from '@modelcontextprotocol/client'");
261
+ expect(template).toContain('InMemoryTransport.createLinkedPair()');
262
+ expect(template).toContain("import { getServer } from './server.js'");
263
+ });
264
+ it('should assert on the parsed payload, not the result wrapper', () => {
265
+ const template = getServerTestTemplate();
266
+ expect(template).toContain('JSON.parse(first.text)');
267
+ expect(template).toContain('result.truncated');
268
+ expect(template).toContain('result.matched');
269
+ });
270
+ it('should cover the contracts that would otherwise fail silently', () => {
271
+ const template = getServerTestTemplate();
272
+ expect(template).toContain('says so when a result is truncated');
273
+ expect(template).toContain('does not claim truncation when everything fits');
274
+ expect(template).toContain('distinguishes an unknown tag from a tag with no notes');
275
+ expect(template).toContain('documents every tool and every parameter');
276
+ });
277
+ // Emitted code with a stray backslash-backtick fails to parse, and the
278
+ // template functions are the only place that can introduce one.
279
+ it('should not emit escaped template-literal syntax', () => {
280
+ const backslash = String.fromCharCode(92);
281
+ for (const template of [getStoreTestTemplate(), getServerTestTemplate()]) {
282
+ expect(template).not.toContain(backslash + '`');
283
+ expect(template).not.toContain(backslash + '$');
284
+ }
285
+ });
286
+ });
141
287
  });
@@ -0,0 +1 @@
1
+ export declare function getToolsTemplate(): string;
@@ -0,0 +1,172 @@
1
+ export function getToolsTemplate() {
2
+ return `import type { CallToolResult, McpServer } from '@modelcontextprotocol/server';
3
+ import { z } from 'zod';
4
+ import * as notes from './notes-store.js';
5
+
6
+ const DEFAULT_LIMIT = 20;
7
+ const MAX_LIMIT = 100;
8
+
9
+ // Names are action-oriented and carry their noun ("list_notes", not "list").
10
+ // Most MCP clients prepend the server name, so an extra "notes_" prefix here
11
+ // would surface as "my-server_notes_list". A bare verb would collide with every
12
+ // other server's "list" on the clients that do not prefix.
13
+
14
+ export function registerTools(server: McpServer): void {
15
+ server.registerTool(
16
+ 'list_notes',
17
+ {
18
+ description:
19
+ 'List saved notes, newest first, optionally filtered by tag. Use this to ' +
20
+ 'find a note before reading or referencing it - for example "what notes do ' +
21
+ 'I have?" or "show me my notes tagged release". Returns a page of notes ' +
22
+ 'plus the total number that matched, so a truncated result is explicit.',
23
+ inputSchema: z.object({
24
+ tag: z
25
+ .string()
26
+ .optional()
27
+ .describe(
28
+ 'Only return notes carrying this tag. Exact match, case-sensitive. ' +
29
+ 'Example: "release". Omit to list every note.'
30
+ ),
31
+ limit: z
32
+ .number()
33
+ .int()
34
+ .min(1)
35
+ .max(MAX_LIMIT)
36
+ .optional()
37
+ .describe(
38
+ \`Maximum notes to return. Integer between 1 and \${MAX_LIMIT}. \` +
39
+ \`Defaults to \${DEFAULT_LIMIT}.\`
40
+ ),
41
+ }),
42
+ },
43
+ async ({ tag, limit }): Promise<CallToolResult> => {
44
+ const effectiveLimit = limit ?? DEFAULT_LIMIT;
45
+
46
+ let result;
47
+ try {
48
+ result = notes.list({ tag, limit: effectiveLimit });
49
+ } catch (error) {
50
+ if (error instanceof notes.UnknownTagError) {
51
+ // An unknown tag and a tag with no notes both produce an empty list.
52
+ // Saying which one happened stops the agent reporting "you have no
53
+ // notes" when the truth is "that tag does not exist".
54
+ const available = notes.knownTags();
55
+ return toolError(
56
+ \`No tag "\${error.tag}" exists, so no notes could match. \` +
57
+ (available.length > 0
58
+ ? \`Available tags: \${available.join(', ')}.\`
59
+ : 'No notes carry tags yet.') +
60
+ ' Call list_notes with no tag to see every note.'
61
+ );
62
+ }
63
+ throw error;
64
+ }
65
+
66
+ const truncated = result.total > result.rows.length;
67
+
68
+ return toolJson({
69
+ notes: result.rows,
70
+ returned: result.rows.length,
71
+ matched: result.total,
72
+ truncated,
73
+ ...(truncated
74
+ ? {
75
+ hint:
76
+ \`Showing \${result.rows.length} of \${result.total} matches. \` +
77
+ 'Narrow the result with a tag filter, or raise limit ' +
78
+ \`(maximum \${MAX_LIMIT}).\`,
79
+ }
80
+ : {}),
81
+ });
82
+ }
83
+ );
84
+
85
+ server.registerTool(
86
+ 'get_note',
87
+ {
88
+ description:
89
+ 'Read one note in full by its id. Use this after list_notes has given ' +
90
+ 'you an id. Returns the note including its body and tags.',
91
+ inputSchema: z.object({
92
+ id: z
93
+ .string()
94
+ .describe(
95
+ 'Note id, exactly as returned by list_notes or create_note. ' +
96
+ 'Format: "note_" followed by 8 hex characters. Example: "note_0000000a".'
97
+ ),
98
+ }),
99
+ },
100
+ async ({ id }): Promise<CallToolResult> => {
101
+ const note = notes.get(id);
102
+
103
+ if (!note) {
104
+ return toolError(
105
+ \`No note has id "\${id}". Ids look like "note_0000000a". \` +
106
+ 'Call list_notes to see the available notes and their ids.'
107
+ );
108
+ }
109
+
110
+ return toolJson(note);
111
+ }
112
+ );
113
+
114
+ server.registerTool(
115
+ 'create_note',
116
+ {
117
+ description:
118
+ 'Save a new note and return it, including the id assigned to it. Use ' +
119
+ 'the returned id to read the note back with get_note - no lookup needed.',
120
+ inputSchema: z.object({
121
+ title: z
122
+ .string()
123
+ .describe(
124
+ 'Short title. Must be non-empty and at most ' +
125
+ \`\${notes.MAX_TITLE_LENGTH} characters. Example: "Ship v2 checklist".\`
126
+ ),
127
+ body: z.string().describe('Note contents as plain text. May be empty.'),
128
+ tags: z
129
+ .array(z.string())
130
+ .optional()
131
+ .describe(
132
+ 'Tags used to filter in list_notes. Lowercase, no spaces. ' +
133
+ 'Example: ["release", "checklist"]. Defaults to no tags.'
134
+ ),
135
+ }),
136
+ },
137
+ async ({ title, body, tags }): Promise<CallToolResult> => {
138
+ try {
139
+ return toolJson(notes.create({ title, body, tags }));
140
+ } catch (error) {
141
+ if (error instanceof RangeError) {
142
+ return toolError(
143
+ \`Could not save the note: \${error.message}. \` +
144
+ 'Retry with a corrected title, for example "Ship v2 checklist".'
145
+ );
146
+ }
147
+ throw error;
148
+ }
149
+ }
150
+ );
151
+ }
152
+
153
+ /** Wraps a payload as the JSON text result an agent reads. */
154
+ function toolJson(payload: unknown): CallToolResult {
155
+ return {
156
+ content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
157
+ };
158
+ }
159
+
160
+ /**
161
+ * An error the agent is meant to act on: it says what went wrong and what to
162
+ * try next. isError keeps it a normal result rather than a protocol failure,
163
+ * so the agent can recover instead of giving up.
164
+ */
165
+ function toolError(message: string): CallToolResult {
166
+ return {
167
+ isError: true,
168
+ content: [{ type: 'text', text: message }],
169
+ };
170
+ }
171
+ `;
172
+ }
@@ -3,3 +3,9 @@ import type { SdkTemplateOptions } from '../../common/types.js';
3
3
  export declare function getIndexTemplate(_options?: SdkTemplateOptions): string;
4
4
  export { getServerTemplate } from './server.js';
5
5
  export { getReadmeTemplate } from './readme.js';
6
+ export { getStoreTemplate } from '../stateless/store.js';
7
+ export { getToolsTemplate } from '../stateless/tools.js';
8
+ export { getPromptsTemplate } from '../stateless/prompts.js';
9
+ export { getResourcesTemplate } from '../stateless/resources.js';
10
+ export { getStoreTestTemplate } from '../stateless/store-test.js';
11
+ export { getServerTestTemplate } from '../stateless/server-test.js';
@@ -12,3 +12,9 @@ console.error('MCP Server running on stdio');
12
12
  }
13
13
  export { getServerTemplate } from './server.js';
14
14
  export { getReadmeTemplate } from './readme.js';
15
+ export { getStoreTemplate } from '../stateless/store.js';
16
+ export { getToolsTemplate } from '../stateless/tools.js';
17
+ export { getPromptsTemplate } from '../stateless/prompts.js';
18
+ export { getResourcesTemplate } from '../stateless/resources.js';
19
+ export { getStoreTestTemplate } from '../stateless/store-test.js';
20
+ export { getServerTestTemplate } from '../stateless/server-test.js';