@gala-chain/launchpad-mcp-server 1.22.0 → 1.22.2

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 (73) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/generated/version.d.ts +1 -1
  3. package/dist/generated/version.js +1 -1
  4. package/package.json +2 -2
  5. package/docs/AI-AGENT-PATTERNS.md +0 -555
  6. package/docs/CONSTRAINTS-REFERENCE.md +0 -454
  7. package/docs/PROMPT-TOOL-MAPPING.md +0 -352
  8. package/docs/examples/default-values-pattern.md +0 -240
  9. package/docs/examples/tool-factory-pattern.md +0 -217
  10. package/jest.config.js +0 -94
  11. package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
  12. package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
  13. package/src/constants/mcpToolNames.ts +0 -141
  14. package/src/index.ts +0 -19
  15. package/src/prompts/__tests__/promptStructure.test.ts +0 -137
  16. package/src/prompts/__tests__/registry.test.ts +0 -191
  17. package/src/prompts/analysis.ts +0 -429
  18. package/src/prompts/create-token.ts +0 -123
  19. package/src/prompts/dex-trading.ts +0 -86
  20. package/src/prompts/discover-tokens.ts +0 -86
  21. package/src/prompts/index.ts +0 -154
  22. package/src/prompts/liquidity-positions.ts +0 -270
  23. package/src/prompts/portfolio.ts +0 -242
  24. package/src/prompts/trading.ts +0 -191
  25. package/src/prompts/utility.ts +0 -43
  26. package/src/prompts/utils/workflowTemplates.ts +0 -511
  27. package/src/schemas/common-schemas.ts +0 -393
  28. package/src/scripts/test-all-prompts.ts +0 -184
  29. package/src/server.ts +0 -277
  30. package/src/tools/__tests__/dex-tools.test.ts +0 -562
  31. package/src/tools/__tests__/liquidity-positions.test.ts +0 -673
  32. package/src/tools/balance/index.ts +0 -174
  33. package/src/tools/creation/index.ts +0 -182
  34. package/src/tools/dex/index.ts +0 -226
  35. package/src/tools/dex/liquidity-positions.ts +0 -547
  36. package/src/tools/index.ts +0 -86
  37. package/src/tools/pools/fetchAllPools.ts +0 -47
  38. package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
  39. package/src/tools/pools/fetchPoolDetails.ts +0 -27
  40. package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
  41. package/src/tools/pools/fetchPools.ts +0 -47
  42. package/src/tools/pools/fetchPriceHistory.ts +0 -124
  43. package/src/tools/pools/fetchTokenDetails.ts +0 -77
  44. package/src/tools/pools/index.ts +0 -284
  45. package/src/tools/social/index.ts +0 -64
  46. package/src/tools/trading/index.ts +0 -605
  47. package/src/tools/transfers/index.ts +0 -75
  48. package/src/tools/utils/clearCache.ts +0 -36
  49. package/src/tools/utils/createWallet.ts +0 -19
  50. package/src/tools/utils/explainSdkUsage.ts +0 -1446
  51. package/src/tools/utils/getAddress.ts +0 -12
  52. package/src/tools/utils/getCacheInfo.ts +0 -14
  53. package/src/tools/utils/getConfig.ts +0 -11
  54. package/src/tools/utils/getEthereumAddress.ts +0 -12
  55. package/src/tools/utils/getUrlByTokenName.ts +0 -12
  56. package/src/tools/utils/getVersion.ts +0 -25
  57. package/src/tools/utils/getWallet.ts +0 -25
  58. package/src/tools/utils/hasWallet.ts +0 -15
  59. package/src/tools/utils/index.ts +0 -33
  60. package/src/tools/utils/isTokenGraduated.ts +0 -16
  61. package/src/tools/utils/setWallet.ts +0 -41
  62. package/src/types/mcp.ts +0 -72
  63. package/src/utils/__tests__/validation.test.ts +0 -147
  64. package/src/utils/constraints.ts +0 -155
  65. package/src/utils/default-values.ts +0 -208
  66. package/src/utils/error-handler.ts +0 -69
  67. package/src/utils/error-templates.ts +0 -273
  68. package/src/utils/response-formatter.ts +0 -51
  69. package/src/utils/tool-factory.ts +0 -257
  70. package/src/utils/tool-registry.ts +0 -296
  71. package/src/utils/validation.ts +0 -371
  72. package/tests/wallet-management-integration.test.ts +0 -284
  73. package/tsconfig.json +0 -23
@@ -1,208 +0,0 @@
1
- /**
2
- * Default Value Utilities
3
- *
4
- * Centralized default values for tool parameters to eliminate magic numbers
5
- * and ensure consistency across 47 MCP tools.
6
- *
7
- * @see Phase 2.2 of refactoring plan
8
- */
9
-
10
- import { MCP_CONSTRAINTS } from './constraints.js';
11
-
12
- // =============================================================================
13
- // Pagination Defaults
14
- // =============================================================================
15
-
16
- /**
17
- * Default pagination configuration
18
- */
19
- export const DEFAULT_PAGINATION = {
20
- page: 1,
21
- limit: 20,
22
- } as const;
23
-
24
- /**
25
- * Operation-specific default limits
26
- */
27
- export const DEFAULT_LIMITS = {
28
- trade: 20,
29
- user: 20,
30
- pool: 20,
31
- comment: 20,
32
- } as const;
33
-
34
- /**
35
- * Maximum limits per operation type (from MCP_CONSTRAINTS)
36
- */
37
- export const MAX_LIMITS = {
38
- trade: MCP_CONSTRAINTS.TRADE_LIMIT, // 20
39
- user: MCP_CONSTRAINTS.USER_LIMIT, // 20
40
- pool: MCP_CONSTRAINTS.POOL_LIMIT, // 100
41
- comment: MCP_CONSTRAINTS.COMMENT_LIMIT, // 50
42
- } as const;
43
-
44
- // =============================================================================
45
- // Trading Defaults
46
- // =============================================================================
47
-
48
- /**
49
- * Default slippage tolerance (1%)
50
- */
51
- export const DEFAULT_SLIPPAGE_TOLERANCE = 0.01;
52
-
53
- /**
54
- * Default reverse bonding curve fee slippage tolerance (1%)
55
- */
56
- export const DEFAULT_RBC_FEE_SLIPPAGE = 0.01;
57
-
58
- /**
59
- * Default pool type for fetchPools
60
- */
61
- export const DEFAULT_POOL_TYPE = 'recent';
62
-
63
- /**
64
- * Default sort order
65
- */
66
- export const DEFAULT_SORT_ORDER = 'DESC';
67
-
68
- // =============================================================================
69
- // Volume Data Defaults
70
- // =============================================================================
71
-
72
- /**
73
- * Default resolution for volume data (1 hour)
74
- */
75
- export const DEFAULT_VOLUME_RESOLUTION = '1h';
76
-
77
- /**
78
- * Resolution mapping (string to seconds)
79
- */
80
- export const RESOLUTION_MAP: Record<string, number> = {
81
- '1m': 60,
82
- '5m': 300,
83
- '15m': 900,
84
- '1h': 3600,
85
- '4h': 14400,
86
- '1d': 86400,
87
- } as const;
88
-
89
- // =============================================================================
90
- // Utility Functions
91
- // =============================================================================
92
-
93
- /**
94
- * Applies default pagination values to args object
95
- *
96
- * @example
97
- * ```typescript
98
- * const params = applyPaginationDefaults(args);
99
- * // { page: 1, limit: 20, ...otherArgs }
100
- * ```
101
- */
102
- export function applyPaginationDefaults<T extends Record<string, any>>(
103
- args: T,
104
- defaults: { page?: number; limit?: number } = DEFAULT_PAGINATION
105
- ): T & { page: number; limit: number } {
106
- return {
107
- ...args,
108
- page: args.page ?? defaults.page ?? DEFAULT_PAGINATION.page,
109
- limit: args.limit ?? defaults.limit ?? DEFAULT_PAGINATION.limit,
110
- };
111
- }
112
-
113
- /**
114
- * Applies operation-specific pagination defaults
115
- *
116
- * @example
117
- * ```typescript
118
- * const params = applyOperationPaginationDefaults(args, 'pool');
119
- * // Uses default limit of 20 for pool operations
120
- * ```
121
- */
122
- export function applyOperationPaginationDefaults<T extends Record<string, any>>(
123
- args: T,
124
- operationType: keyof typeof DEFAULT_LIMITS
125
- ): T & { page: number; limit: number } {
126
- return applyPaginationDefaults(args, {
127
- page: DEFAULT_PAGINATION.page,
128
- limit: DEFAULT_LIMITS[operationType],
129
- });
130
- }
131
-
132
- /**
133
- * Applies default slippage values to trading args
134
- *
135
- * @example
136
- * ```typescript
137
- * const params = applySlippageDefaults(args);
138
- * // { slippageToleranceFactor: 0.01, maxAcceptableReverseBondingCurveFeeSlippageFactor: 0.01, ...args }
139
- * ```
140
- */
141
- export function applySlippageDefaults<T extends Record<string, any>>(
142
- args: T,
143
- defaults: {
144
- slippageToleranceFactor?: number;
145
- maxAcceptableReverseBondingCurveFeeSlippageFactor?: number;
146
- } = {}
147
- ): T & {
148
- slippageToleranceFactor: number;
149
- maxAcceptableReverseBondingCurveFeeSlippageFactor: number;
150
- } {
151
- return {
152
- ...args,
153
- slippageToleranceFactor:
154
- args.slippageToleranceFactor ??
155
- defaults.slippageToleranceFactor ??
156
- DEFAULT_SLIPPAGE_TOLERANCE,
157
- maxAcceptableReverseBondingCurveFeeSlippageFactor:
158
- args.maxAcceptableReverseBondingCurveFeeSlippageFactor ??
159
- defaults.maxAcceptableReverseBondingCurveFeeSlippageFactor ??
160
- DEFAULT_RBC_FEE_SLIPPAGE,
161
- };
162
- }
163
-
164
- /**
165
- * Converts volume resolution string to seconds
166
- *
167
- * @example
168
- * ```typescript
169
- * const seconds = resolutionToSeconds('1h', '1h');
170
- * // 3600
171
- * ```
172
- */
173
- export function resolutionToSeconds(
174
- resolution: string | undefined,
175
- defaultResolution: string = DEFAULT_VOLUME_RESOLUTION
176
- ): number {
177
- return RESOLUTION_MAP[resolution ?? defaultResolution] ?? RESOLUTION_MAP[defaultResolution];
178
- }
179
-
180
- /**
181
- * Converts ISO 8601 date string to Unix timestamp (seconds)
182
- *
183
- * @example
184
- * ```typescript
185
- * const timestamp = dateToUnixTimestamp('2024-01-15T14:30:25Z');
186
- * // 1705329025
187
- * ```
188
- */
189
- export function dateToUnixTimestamp(isoDate: string | undefined): number | undefined {
190
- if (!isoDate) return undefined;
191
- return Math.floor(new Date(isoDate).getTime() / 1000);
192
- }
193
-
194
- // =============================================================================
195
- // Export All
196
- // =============================================================================
197
-
198
- export const defaultValues = {
199
- pagination: DEFAULT_PAGINATION,
200
- limits: DEFAULT_LIMITS,
201
- maxLimits: MAX_LIMITS,
202
- slippageTolerance: DEFAULT_SLIPPAGE_TOLERANCE,
203
- rbcFeeSlippage: DEFAULT_RBC_FEE_SLIPPAGE,
204
- poolType: DEFAULT_POOL_TYPE,
205
- sortOrder: DEFAULT_SORT_ORDER,
206
- volumeResolution: DEFAULT_VOLUME_RESOLUTION,
207
- resolutionMap: RESOLUTION_MAP,
208
- };
@@ -1,69 +0,0 @@
1
- /**
2
- * Error Handler Utility
3
- *
4
- * Formats errors for MCP protocol responses with AI-friendly tips.
5
- * Uses centralized error templates from error-templates.ts.
6
- *
7
- * @see src/utils/error-templates.ts
8
- */
9
-
10
- import type { MCPToolResponse } from '../types/mcp.js';
11
- import { enhanceErrorMessage } from './error-templates.js';
12
-
13
- /**
14
- * Format error for MCP response with AI-friendly tips
15
- */
16
- export function formatError(error: unknown): MCPToolResponse {
17
- const errorMessage = error instanceof Error ? error.message : String(error);
18
-
19
- // Sanitize sensitive information from error messages
20
- const sanitized = sanitizeError(errorMessage);
21
-
22
- // Add AI-friendly tips using centralized templates
23
- const withTips = enhanceErrorMessage(sanitized);
24
-
25
- return {
26
- content: [
27
- {
28
- type: 'text',
29
- text: `Error: ${withTips}`,
30
- },
31
- ],
32
- isError: true,
33
- };
34
- }
35
-
36
- /**
37
- * Sanitize error messages to remove sensitive information
38
- */
39
- function sanitizeError(message: string): string {
40
- // Remove private keys
41
- let sanitized = message.replace(/0x[a-fA-F0-9]{64}/g, '0x***');
42
-
43
- // Remove eth| addresses but keep format visible
44
- sanitized = sanitized.replace(/(eth\|)[a-fA-F0-9]{40}/g, '$1***');
45
-
46
- // Remove 0x addresses but keep format visible
47
- sanitized = sanitized.replace(/(0x)[a-fA-F0-9]{40}/g, '$1***');
48
-
49
- return sanitized;
50
- }
51
-
52
- /**
53
- * Wrap handler with error handling
54
- *
55
- * @template TArgs - Array of argument types
56
- * @param handler - Handler function to wrap with error handling
57
- * @returns Wrapped handler with automatic error formatting
58
- */
59
- export function withErrorHandling<TArgs extends unknown[]>(
60
- handler: (...args: TArgs) => Promise<MCPToolResponse>
61
- ): (...args: TArgs) => Promise<MCPToolResponse> {
62
- return async (...args: TArgs): Promise<MCPToolResponse> => {
63
- try {
64
- return await handler(...args);
65
- } catch (error) {
66
- return formatError(error);
67
- }
68
- };
69
- }
@@ -1,273 +0,0 @@
1
- /**
2
- * Error Message Templates
3
- *
4
- * Centralized error messages with AI-friendly tips for common error patterns.
5
- * Eliminates duplication and ensures consistent error messaging.
6
- *
7
- * @see Phase 3.3 of refactoring plan
8
- */
9
-
10
- // =============================================================================
11
- // Type Definitions
12
- // =============================================================================
13
-
14
- /**
15
- * Error template with AI-friendly tip
16
- */
17
- export interface ErrorTemplate {
18
- pattern: RegExp | string;
19
- tip: string;
20
- category: 'validation' | 'timeout' | 'format' | 'business-logic' | 'network';
21
- }
22
-
23
- // =============================================================================
24
- // Validation Error Templates
25
- // =============================================================================
26
-
27
- /**
28
- * Limit validation errors
29
- */
30
- export const LIMIT_ERRORS = {
31
- trade: {
32
- pattern: /Limit must be.*20/,
33
- tip: `💡 AI TIP: Trade and user operations have a maximum limit of 20. Use:
34
- - gala_launchpad_fetch_trades: limit ≤ 20
35
- - gala_launchpad_fetch_tokens_held: limit ≤ 20
36
- - gala_launchpad_fetch_tokens_created: limit ≤ 20
37
-
38
- See docs/CONSTRAINTS-REFERENCE.md for details.`,
39
- category: 'validation' as const,
40
- },
41
- comment: {
42
- pattern: /Limit must be.*50/,
43
- tip: `💡 AI TIP: Comment operations have a maximum limit of 50. Use:
44
- - gala_launchpad_fetch_comments: limit ≤ 50
45
-
46
- See docs/CONSTRAINTS-REFERENCE.md for details.`,
47
- category: 'validation' as const,
48
- },
49
- pool: {
50
- pattern: /Limit must be.*100/,
51
- tip: `💡 AI TIP: Pool operations have a maximum limit of 100. Use:
52
- - gala_launchpad_fetch_pools: limit ≤ 100
53
-
54
- See docs/CONSTRAINTS-REFERENCE.md for details.`,
55
- category: 'validation' as const,
56
- },
57
- } as const;
58
-
59
- /**
60
- * Token name validation errors
61
- */
62
- export const TOKEN_NAME_ERROR: ErrorTemplate = {
63
- pattern: /token name.*(invalid|validation)/i,
64
- tip: `💡 AI TIP: Token names must match pattern ^[a-z0-9_-]{2,20}$:
65
- - Lowercase letters and numbers only
66
- - Dashes and underscores allowed
67
- - Length: 2-20 characters
68
- - Valid examples: 'mytoken', 'test-token', 'token_123'
69
- - Invalid: 'MyToken' (uppercase), 'a' (too short), 'my token' (space)`,
70
- category: 'validation',
71
- };
72
-
73
- /**
74
- * Token symbol validation errors
75
- */
76
- export const TOKEN_SYMBOL_ERROR: ErrorTemplate = {
77
- pattern: /token symbol.*(invalid|validation)/i,
78
- tip: `💡 AI TIP: Token symbols must match pattern ^[A-Z0-9]{2,10}$:
79
- - Uppercase letters and numbers only
80
- - No special characters
81
- - Length: 2-10 characters
82
- - Valid examples: 'MTK', 'TEST123', 'ABC'
83
- - Invalid: 'mtk' (lowercase), 'A' (too short), 'MY-TOKEN' (dash)`,
84
- category: 'validation',
85
- };
86
-
87
- /**
88
- * Wallet address format errors
89
- */
90
- export const ADDRESS_FORMAT_ERROR: ErrorTemplate = {
91
- pattern: /address.*(format|validation)/i,
92
- tip: `💡 AI TIP: Wallet addresses must use format:
93
- - Backend API: 'eth|{40-hex-chars}' (e.g., 'eth|abc123...')
94
- - Convert from standard: address.startsWith('0x') ? \`eth|\${address.slice(2)}\` : address
95
- - Most MCP tools expect 'eth|...' format`,
96
- category: 'format',
97
- };
98
-
99
- // =============================================================================
100
- // Trading Error Templates
101
- // =============================================================================
102
-
103
- /**
104
- * WebSocket/trade timeout errors
105
- */
106
- export const TRADE_TIMEOUT_ERROR: ErrorTemplate = {
107
- pattern: /(timeout|WebSocket)/i,
108
- tip: `💡 AI TIP: Trade execution timeouts often indicate incorrect expectedAmount parameter.
109
-
110
- ✅ CORRECT WORKFLOW:
111
- 1. Call calculate_buy_amount() or calculate_sell_amount()
112
- 2. Extract result.amount from response (e.g., "16843.7579794843252")
113
- 3. Use result.amount as expectedAmount in buy() or sell()
114
-
115
- ❌ WRONG: Using your input amount as expectedAmount
116
- ✅ RIGHT: Using calculated result.amount as expectedAmount
117
-
118
- See docs/AI-AGENT-PATTERNS.md section "Gotcha #1" for examples.`,
119
- category: 'timeout',
120
- };
121
-
122
- /**
123
- * Slippage/amount errors
124
- */
125
- export const SLIPPAGE_ERROR: ErrorTemplate = {
126
- pattern: /(slippage|amount.*expected)/i,
127
- tip: `💡 AI TIP: expectedAmount must be the calculated output from calculate functions, NOT your input amount.
128
-
129
- Example:
130
- const calc = await calculateBuyAmount({ amount: '10', type: 'native', ... });
131
- // calc.amount = "16843.7579794843252" <- Use THIS as expectedAmount
132
- await buy({ amount: '10', expectedAmount: calc.amount, ... });
133
-
134
- See docs/AI-AGENT-PATTERNS.md for complete trading workflow.`,
135
- category: 'business-logic',
136
- };
137
-
138
- /**
139
- * Type parameter confusion
140
- */
141
- export const TRADE_TYPE_ERROR: ErrorTemplate = {
142
- pattern: /type.*(native|token)/i,
143
- tip: `💡 AI TIP: Trading type parameter:
144
- - 'native': You specify GALA amount (most common)
145
- Example: "I want to spend 10 GALA" → type: 'native', amount: '10'
146
- - 'exact': You specify exact token amount
147
- Example: "I want to buy exactly 1000 tokens" → type: 'exact', amount: '1000'
148
-
149
- See docs/AI-AGENT-PATTERNS.md section "Gotcha #3" for details.`,
150
- category: 'validation',
151
- };
152
-
153
- // =============================================================================
154
- // Token Creation Error Templates
155
- // =============================================================================
156
-
157
- /**
158
- * Social URL requirement errors
159
- */
160
- export const SOCIAL_URL_ERROR: ErrorTemplate = {
161
- pattern: /(social|URL.*required)/i,
162
- tip: `💡 AI TIP: Token launch requires at least ONE social URL:
163
- - websiteUrl (e.g., 'https://mytoken.com')
164
- - twitterUrl (e.g., 'https://twitter.com/mytoken')
165
- - telegramUrl (e.g., 'https://t.me/mytoken')
166
-
167
- Provide at least one in launchToken() call.`,
168
- category: 'validation',
169
- };
170
-
171
- // =============================================================================
172
- // Generic Error Templates
173
- // =============================================================================
174
-
175
- /**
176
- * Generic validation error
177
- */
178
- export const GENERIC_VALIDATION_ERROR: ErrorTemplate = {
179
- pattern: /(validation|invalid)/i,
180
- tip: `💡 AI TIP: Check parameter formats in docs/AI-AGENT-PATTERNS.md
181
- Common validation rules:
182
- - tokenName: ^[a-z0-9_-]{2,20}$ (lowercase, 2-20 chars)
183
- - tokenSymbol: ^[A-Z0-9]{2,10}$ (uppercase, 2-10 chars)
184
- - address: 'eth|...' or '0x...' format (auto-normalized)
185
- - amount: ^[0-9.]+$ (decimal string)
186
- - limits: See CONSTRAINTS-REFERENCE.md`,
187
- category: 'validation',
188
- };
189
-
190
- // =============================================================================
191
- // Error Template Registry
192
- // =============================================================================
193
-
194
- /**
195
- * All error templates in priority order (checked sequentially)
196
- */
197
- export const ERROR_TEMPLATES: ErrorTemplate[] = [
198
- // Specific errors first (higher priority)
199
- LIMIT_ERRORS.trade,
200
- LIMIT_ERRORS.comment,
201
- LIMIT_ERRORS.pool,
202
- TOKEN_NAME_ERROR,
203
- TOKEN_SYMBOL_ERROR,
204
- ADDRESS_FORMAT_ERROR,
205
- TRADE_TIMEOUT_ERROR,
206
- SLIPPAGE_ERROR,
207
- TRADE_TYPE_ERROR,
208
- SOCIAL_URL_ERROR,
209
-
210
- // Generic errors last (lower priority)
211
- GENERIC_VALIDATION_ERROR,
212
- ];
213
-
214
- // =============================================================================
215
- // Template Matching Functions
216
- // =============================================================================
217
-
218
- /**
219
- * Finds the best matching error template for a message
220
- */
221
- export function findErrorTemplate(message: string): ErrorTemplate | null {
222
- for (const template of ERROR_TEMPLATES) {
223
- const pattern = template.pattern;
224
-
225
- if (typeof pattern === 'string') {
226
- if (message.includes(pattern)) {
227
- return template;
228
- }
229
- } else if (pattern instanceof RegExp) {
230
- if (pattern.test(message)) {
231
- return template;
232
- }
233
- }
234
- }
235
-
236
- return null;
237
- }
238
-
239
- /**
240
- * Gets the AI-friendly tip for an error message
241
- */
242
- export function getErrorTip(message: string): string | null {
243
- const template = findErrorTemplate(message);
244
- return template ? template.tip : null;
245
- }
246
-
247
- /**
248
- * Applies AI-friendly tip to error message
249
- */
250
- export function enhanceErrorMessage(message: string): string {
251
- const tip = getErrorTip(message);
252
- return tip ? `${message}\n\n${tip}` : message;
253
- }
254
-
255
- /**
256
- * Gets error category for an error message
257
- */
258
- export function getErrorCategory(message: string): string {
259
- const template = findErrorTemplate(message);
260
- return template ? template.category : 'unknown';
261
- }
262
-
263
- // =============================================================================
264
- // Export All
265
- // =============================================================================
266
-
267
- export const errorTemplates = {
268
- templates: ERROR_TEMPLATES,
269
- findTemplate: findErrorTemplate,
270
- getTip: getErrorTip,
271
- enhance: enhanceErrorMessage,
272
- getCategory: getErrorCategory,
273
- };
@@ -1,51 +0,0 @@
1
- /**
2
- * Response Formatter Utility
3
- *
4
- * Formats SDK responses for MCP protocol
5
- */
6
-
7
- import type { MCPToolResponse } from '../types/mcp.js';
8
-
9
- /**
10
- * Format successful response
11
- */
12
- export function formatSuccess(data: any): MCPToolResponse {
13
- return {
14
- content: [
15
- {
16
- type: 'text',
17
- text: JSON.stringify(data, null, 2),
18
- },
19
- ],
20
- };
21
- }
22
-
23
- /**
24
- * Format boolean response
25
- */
26
- export function formatBoolean(result: boolean, message?: string): MCPToolResponse {
27
- const text = message || `Result: ${result}`;
28
-
29
- return {
30
- content: [
31
- {
32
- type: 'text',
33
- text: JSON.stringify({ success: result, message: text }, null, 2),
34
- },
35
- ],
36
- };
37
- }
38
-
39
- /**
40
- * Format simple text response
41
- */
42
- export function formatText(text: string): MCPToolResponse {
43
- return {
44
- content: [
45
- {
46
- type: 'text',
47
- text,
48
- },
49
- ],
50
- };
51
- }