@smartbear/mcp 0.3.0 → 0.4.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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@smartbear/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "MCP server for interacting SmartBear Products",
5
5
  "keywords": [
6
6
  "smartbear",
7
7
  "mcp",
8
8
  "insight-hub",
9
9
  "reflect",
10
- "api-hub"
10
+ "api-hub",
11
+ "pactflow"
11
12
  ],
12
13
  "homepage": "https://developer.smartbear.com/smartbear-mcp",
13
14
  "repository": {
@@ -1,57 +0,0 @@
1
- export function toolDescriptionTemplate(params) {
2
- const { summary, useCases, examples, parameters, hints, outputFormat } = params;
3
- let description = summary;
4
- // Parameters (essential)
5
- if (parameters.length > 0) {
6
- description += `\n\n**Parameters:** ${parameters.map(p => `${p.name} (${p.type})${p.required ? ' *required*' : ''}`).join(', ')}`;
7
- }
8
- if (outputFormat) {
9
- description += `\n\n**Output Format:** ${outputFormat}`;
10
- }
11
- // Use Cases
12
- if (useCases.length > 0) {
13
- description += `\n\n**Use Cases:** ${useCases.map((uc, i) => `${i + 1}. ${uc}`).join(' ')}`;
14
- }
15
- // Examples
16
- if (examples.length > 0) {
17
- description += `\n\n**Examples:**\n` + examples.map((ex, idx) => `${idx + 1}. ${ex.description}\n\`\`\`json\n${JSON.stringify(ex.parameters, null, 2)}\n\`\`\`${ex.expectedOutput ? `\nExpected Output: ${ex.expectedOutput}` : ''}`).join('\n\n');
18
- }
19
- // Hints
20
- if (hints.length > 0) {
21
- description += `\n\n**Tips:** ${hints.map((hint, i) => `${i + 1}. ${hint}`).join(' ')}`;
22
- }
23
- return description.trim();
24
- }
25
- // Backward-compatible version of the original function
26
- export function simpleToolDescriptionTemplate(summary, useCases, examples, hints) {
27
- return toolDescriptionTemplate({
28
- summary,
29
- purpose: summary,
30
- useCases,
31
- examples: examples.map(example => ({
32
- description: example,
33
- parameters: {}
34
- })),
35
- parameters: [],
36
- hints
37
- });
38
- }
39
- // Helper function to create parameter descriptions
40
- export function createParameter(name, type, required, description, options = {}) {
41
- return {
42
- name,
43
- type,
44
- required,
45
- description,
46
- examples: options.examples,
47
- constraints: options.constraints
48
- };
49
- }
50
- // Helper function to create examples with proper structure
51
- export function createExample(description, parameters, expectedOutput) {
52
- return {
53
- description,
54
- parameters,
55
- expectedOutput
56
- };
57
- }
@@ -1,149 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { toolDescriptionTemplate, createParameter, createExample } from '../../../common/templates.js';
3
- describe('Template Utilities', () => {
4
- describe('createParameter', () => {
5
- it('should create basic parameter object', () => {
6
- const result = createParameter('testParam', 'string', true, 'A test parameter');
7
- expect(result).toEqual({
8
- name: 'testParam',
9
- type: 'string',
10
- required: true,
11
- description: 'A test parameter'
12
- });
13
- });
14
- it('should create parameter with options', () => {
15
- const result = createParameter('testParam', 'number', false, 'A test parameter', {
16
- examples: ['1', '2', '3'],
17
- constraints: ['Must be positive']
18
- });
19
- expect(result).toEqual({
20
- name: 'testParam',
21
- type: 'number',
22
- required: false,
23
- description: 'A test parameter',
24
- examples: ['1', '2', '3'],
25
- constraints: ['Must be positive']
26
- });
27
- });
28
- });
29
- describe('createExample', () => {
30
- it('should create basic example object', () => {
31
- const result = createExample('Test example', { param1: 'value1' });
32
- expect(result).toEqual({
33
- description: 'Test example',
34
- parameters: { param1: 'value1' }
35
- });
36
- });
37
- it('should create example with expected output', () => {
38
- const result = createExample('Test example', { param1: 'value1' }, 'Expected result');
39
- expect(result).toEqual({
40
- description: 'Test example',
41
- parameters: { param1: 'value1' },
42
- expectedOutput: 'Expected result'
43
- });
44
- });
45
- });
46
- describe('toolDescriptionTemplate', () => {
47
- it('should generate basic tool description', () => {
48
- const params = {
49
- summary: 'Test tool summary',
50
- purpose: 'Test purpose',
51
- useCases: ['Use case 1', 'Use case 2'],
52
- examples: [
53
- {
54
- description: 'Example 1',
55
- parameters: { param1: 'value1' },
56
- expectedOutput: 'Result 1'
57
- }
58
- ],
59
- parameters: [
60
- {
61
- name: 'param1',
62
- type: 'string',
63
- required: true,
64
- description: 'Test parameter'
65
- }
66
- ],
67
- hints: ['Hint 1', 'Hint 2']
68
- };
69
- const result = toolDescriptionTemplate(params);
70
- expect(result).toContain('Test tool summary');
71
- expect(result).toContain('**Parameters:** param1 (string) *required*');
72
- expect(result).toContain('**Use Cases:** 1. Use case 1 2. Use case 2');
73
- expect(result).toContain('**Examples:**');
74
- expect(result).toContain('Example 1');
75
- expect(result).toContain('param1');
76
- expect(result).toContain('value1');
77
- expect(result).toContain('Expected Output: Result 1');
78
- expect(result).toContain('**Tips:** 1. Hint 1 2. Hint 2');
79
- });
80
- it('should handle optional parameters correctly', () => {
81
- const params = {
82
- summary: 'Test tool',
83
- purpose: 'Test purpose',
84
- useCases: ['Use case'],
85
- examples: [],
86
- parameters: [
87
- {
88
- name: 'required_param',
89
- type: 'string',
90
- required: true,
91
- description: 'Required parameter'
92
- },
93
- {
94
- name: 'optional_param',
95
- type: 'number',
96
- required: false,
97
- description: 'Optional parameter'
98
- }
99
- ],
100
- hints: []
101
- };
102
- const result = toolDescriptionTemplate(params);
103
- expect(result).toContain('required_param (string) *required*');
104
- expect(result).toContain('optional_param (number)');
105
- expect(result).not.toContain('optional_param (number) *required*');
106
- });
107
- it('should handle empty sections gracefully', () => {
108
- const params = {
109
- summary: 'Minimal tool',
110
- purpose: 'Test purpose',
111
- useCases: [],
112
- examples: [],
113
- parameters: [],
114
- hints: []
115
- };
116
- const result = toolDescriptionTemplate(params);
117
- expect(result).toBe('Minimal tool');
118
- expect(result).not.toContain('**Parameters:**');
119
- expect(result).not.toContain('**Use Cases:**');
120
- expect(result).not.toContain('**Examples:**');
121
- expect(result).not.toContain('**Tips:**');
122
- });
123
- it('should format JSON examples correctly', () => {
124
- const params = {
125
- summary: 'Test tool',
126
- purpose: 'Test purpose',
127
- useCases: ['Test'],
128
- examples: [
129
- {
130
- description: 'Complex example',
131
- parameters: {
132
- nested: {
133
- object: 'value',
134
- array: [1, 2, 3]
135
- }
136
- }
137
- }
138
- ],
139
- parameters: [],
140
- hints: []
141
- };
142
- const result = toolDescriptionTemplate(params);
143
- expect(result).toContain('```json');
144
- expect(result).toContain('"nested"');
145
- expect(result).toContain('"object": "value"');
146
- expect(result).toContain('"array": [');
147
- });
148
- });
149
- });