swagger-doc-explorer-mcp 0.0.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.
- package/LICENSE +21 -0
- package/README.md +159 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +3 -0
- package/dist/constants.js.map +1 -0
- package/dist/formatters.d.ts +27 -0
- package/dist/formatters.d.ts.map +1 -0
- package/dist/formatters.js +163 -0
- package/dist/formatters.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/services/swagger-service.d.ts +21 -0
- package/dist/services/swagger-service.d.ts.map +1 -0
- package/dist/services/swagger-service.js +339 -0
- package/dist/services/swagger-service.js.map +1 -0
- package/dist/tools/info.d.ts +3 -0
- package/dist/tools/info.d.ts.map +1 -0
- package/dist/tools/info.js +161 -0
- package/dist/tools/info.js.map +1 -0
- package/dist/tools/load-spec.d.ts +3 -0
- package/dist/tools/load-spec.d.ts.map +1 -0
- package/dist/tools/load-spec.js +278 -0
- package/dist/tools/load-spec.js.map +1 -0
- package/dist/tools/paths.d.ts +3 -0
- package/dist/tools/paths.d.ts.map +1 -0
- package/dist/tools/paths.js +216 -0
- package/dist/tools/paths.js.map +1 -0
- package/dist/tools/schemas.d.ts +3 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +142 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools/search.d.ts +3 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +100 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { loadSpec, loadSpecFromFile, isLoaded, getSpecKeys, getSpec, getEndpoints, getSchemas, getTags, getServerUrl, removeSpec } from "../services/swagger-service.js";
|
|
3
|
+
export function registerLoadSpecTools(server) {
|
|
4
|
+
server.registerTool("swagger_load_spec", {
|
|
5
|
+
title: "Load Swagger/OpenAPI Spec",
|
|
6
|
+
description: `Load and parse an OpenAPI (Swagger) specification document from a URL.
|
|
7
|
+
|
|
8
|
+
This tool fetches a JSON OpenAPI/Swagger spec from the given URL and stores it in memory for subsequent exploration. You must load a spec before using any other tools.
|
|
9
|
+
|
|
10
|
+
Each loaded spec is assigned a unique name (title + version). If a spec with the same name already exists, a numeric suffix is appended.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
- url (string): URL to the OpenAPI/Swagger JSON spec (e.g., "https://petstore.swagger.io/v2/swagger.json")
|
|
14
|
+
- auth_header (string, optional): Authorization header value for protected specs (e.g., "Bearer token123" or "Basic base64encoded"). Only needed for authenticated endpoints.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
{
|
|
18
|
+
"spec_name": string, // The assigned spec name for subsequent tools
|
|
19
|
+
"title": string, // API title from the spec
|
|
20
|
+
"version": string, // API version from the spec
|
|
21
|
+
"description": string, // API description (if available)
|
|
22
|
+
"endpoints": number, // Total number of API endpoints found
|
|
23
|
+
"schemas": number, // Total number of schemas/components found
|
|
24
|
+
"tags": number, // Total number of unique tags found
|
|
25
|
+
"server_url": string // Base server URL from the spec
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
- Use when: "Load the Petstore API spec" -> params with url="https://petstore.swagger.io/v2/swagger.json"
|
|
30
|
+
- Use when: "Load our internal API docs" -> params with url="https://api.internal.company.com/openapi.json"
|
|
31
|
+
|
|
32
|
+
Error Handling:
|
|
33
|
+
- Returns error if URL is unreachable or times out
|
|
34
|
+
- Returns error if the document is not valid OpenAPI/Swagger JSON
|
|
35
|
+
- Returns error if YAML format is provided (only JSON is supported)`,
|
|
36
|
+
inputSchema: z.object({
|
|
37
|
+
url: z.string().url().describe("URL to the OpenAPI/Swagger JSON spec (e.g., 'https://petstore.swagger.io/v2/swagger.json')"),
|
|
38
|
+
auth_header: z.string().optional().describe("Authorization header value for protected specs (e.g., 'Bearer eyJhbGci...' or 'Basic base64string'). Only needed if the spec requires authentication."),
|
|
39
|
+
}).strict(),
|
|
40
|
+
annotations: {
|
|
41
|
+
readOnlyHint: true,
|
|
42
|
+
destructiveHint: false,
|
|
43
|
+
idempotentHint: false,
|
|
44
|
+
openWorldHint: true,
|
|
45
|
+
},
|
|
46
|
+
}, async (params) => {
|
|
47
|
+
try {
|
|
48
|
+
const store = await loadSpec(params.url, params.auth_header);
|
|
49
|
+
const endpoints = getEndpoints(store.name);
|
|
50
|
+
const schemas = getSchemas(store.name);
|
|
51
|
+
const tags = getTags(store.name);
|
|
52
|
+
const serverUrl = getServerUrl(store.name);
|
|
53
|
+
const output = {
|
|
54
|
+
spec_name: store.name,
|
|
55
|
+
title: store.spec.info.title,
|
|
56
|
+
version: store.spec.info.version,
|
|
57
|
+
description: store.spec.info.description || "",
|
|
58
|
+
endpoints: endpoints.length,
|
|
59
|
+
schemas: schemas.length,
|
|
60
|
+
tags: tags.length,
|
|
61
|
+
server_url: serverUrl,
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
content: [{
|
|
65
|
+
type: "text",
|
|
66
|
+
text: [
|
|
67
|
+
`# ${output.title} v${output.version}`,
|
|
68
|
+
"",
|
|
69
|
+
output.description,
|
|
70
|
+
"",
|
|
71
|
+
"## Summary",
|
|
72
|
+
`- **Spec Name**: \`${output.spec_name}\``,
|
|
73
|
+
`- **Endpoints**: ${output.endpoints} paths`,
|
|
74
|
+
`- **Schemas**: ${output.schemas} component schemas`,
|
|
75
|
+
`- **Tags**: ${output.tags} groups`,
|
|
76
|
+
`- **Server**: \`${output.server_url || "Not specified"}\``,
|
|
77
|
+
].join("\n"),
|
|
78
|
+
}],
|
|
79
|
+
structuredContent: output,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
return {
|
|
84
|
+
content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
server.registerTool("swagger_load_local_spec", {
|
|
89
|
+
title: "Load Local Swagger/OpenAPI Spec File",
|
|
90
|
+
description: `Load and parse an OpenAPI (Swagger) specification document from a local JSON file.
|
|
91
|
+
|
|
92
|
+
This tool reads a JSON OpenAPI/Swagger spec from a local file path and stores it in memory for subsequent exploration. The file path can be absolute or relative to the current working directory.
|
|
93
|
+
|
|
94
|
+
Each loaded spec is assigned a unique name (title + version). If a spec with the same name already exists, a numeric suffix is appended.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
- file_path (string): Path to a local OpenAPI/Swagger JSON file (e.g., "./swagger.doc.json" or "/path/to/api-spec.json")
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
{
|
|
101
|
+
"spec_name": string, // The assigned spec name for subsequent tools
|
|
102
|
+
"title": string, // API title from the spec
|
|
103
|
+
"version": string, // API version from the spec
|
|
104
|
+
"description": string, // API description (if available)
|
|
105
|
+
"endpoints": number, // Total number of API endpoints found
|
|
106
|
+
"schemas": number, // Total number of schemas/components found
|
|
107
|
+
"tags": number, // Total number of unique tags found
|
|
108
|
+
"server_url": string // Base server URL from the spec
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
Examples:
|
|
112
|
+
- Use when: "Load the local swagger.doc.json" -> params with file_path="./swagger.doc.json"
|
|
113
|
+
- Use when: "Load our API spec from disk" -> params with file_path="/home/user/projects/api/openapi.json"
|
|
114
|
+
|
|
115
|
+
Error Handling:
|
|
116
|
+
- Returns error if the file path does not exist
|
|
117
|
+
- Returns error if the file is not valid JSON
|
|
118
|
+
- Returns error if the JSON is not a valid OpenAPI/Swagger spec`,
|
|
119
|
+
inputSchema: z.object({
|
|
120
|
+
file_path: z.string().min(1).describe("Path to a local OpenAPI/Swagger JSON file (e.g., './swagger.doc.json' or '/absolute/path/to/spec.json')"),
|
|
121
|
+
}).strict(),
|
|
122
|
+
annotations: {
|
|
123
|
+
readOnlyHint: true,
|
|
124
|
+
destructiveHint: false,
|
|
125
|
+
idempotentHint: false,
|
|
126
|
+
openWorldHint: true,
|
|
127
|
+
},
|
|
128
|
+
}, async (params) => {
|
|
129
|
+
try {
|
|
130
|
+
const store = await loadSpecFromFile(params.file_path);
|
|
131
|
+
const endpoints = getEndpoints(store.name);
|
|
132
|
+
const schemas = getSchemas(store.name);
|
|
133
|
+
const tags = getTags(store.name);
|
|
134
|
+
const serverUrl = getServerUrl(store.name);
|
|
135
|
+
const output = {
|
|
136
|
+
spec_name: store.name,
|
|
137
|
+
title: store.spec.info.title,
|
|
138
|
+
version: store.spec.info.version,
|
|
139
|
+
description: store.spec.info.description || "",
|
|
140
|
+
endpoints: endpoints.length,
|
|
141
|
+
schemas: schemas.length,
|
|
142
|
+
tags: tags.length,
|
|
143
|
+
server_url: serverUrl,
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
content: [{
|
|
147
|
+
type: "text",
|
|
148
|
+
text: [
|
|
149
|
+
`# ${output.title} v${output.version}`,
|
|
150
|
+
"",
|
|
151
|
+
output.description,
|
|
152
|
+
"",
|
|
153
|
+
"## Summary",
|
|
154
|
+
`- **Spec Name**: \`${output.spec_name}\``,
|
|
155
|
+
`- **Source**: \`${store.source}\``,
|
|
156
|
+
`- **Endpoints**: ${output.endpoints} paths`,
|
|
157
|
+
`- **Schemas**: ${output.schemas} component schemas`,
|
|
158
|
+
`- **Tags**: ${output.tags} groups`,
|
|
159
|
+
`- **Server**: \`${output.server_url || "Not specified"}\``,
|
|
160
|
+
].join("\n"),
|
|
161
|
+
}],
|
|
162
|
+
structuredContent: output,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
return {
|
|
167
|
+
content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
server.registerTool("swagger_list_loaded", {
|
|
172
|
+
title: "List Loaded Specs",
|
|
173
|
+
description: `List all currently loaded OpenAPI/Swagger specifications in memory.
|
|
174
|
+
|
|
175
|
+
Use this tool to see which specs have been loaded and are available for exploration.
|
|
176
|
+
|
|
177
|
+
Args: None
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
{
|
|
181
|
+
"loaded": [ // Array of loaded specs
|
|
182
|
+
{ "name": string, "title": string, "version": string, "source": string, "loaded_at": string }
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
Examples:
|
|
187
|
+
- Use when: "What specs have I loaded?" -> no params needed
|
|
188
|
+
- Use when: "Show my loaded APIs" -> no params needed`,
|
|
189
|
+
inputSchema: z.object({}).strict(),
|
|
190
|
+
annotations: {
|
|
191
|
+
readOnlyHint: true,
|
|
192
|
+
destructiveHint: false,
|
|
193
|
+
idempotentHint: true,
|
|
194
|
+
openWorldHint: false,
|
|
195
|
+
},
|
|
196
|
+
}, async () => {
|
|
197
|
+
try {
|
|
198
|
+
const names = getSpecKeys();
|
|
199
|
+
const specs = names.map((name) => {
|
|
200
|
+
const store = getSpec(name);
|
|
201
|
+
return {
|
|
202
|
+
name,
|
|
203
|
+
title: store?.spec.info.title || "Unknown",
|
|
204
|
+
version: store?.spec.info.version || "?",
|
|
205
|
+
source: store?.source || "?",
|
|
206
|
+
loaded_at: store?.loadedAt || "?",
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
if (specs.length === 0) {
|
|
210
|
+
return {
|
|
211
|
+
content: [{ type: "text", text: "No specs loaded. Use `swagger_load_spec` to load an OpenAPI/Swagger spec." }],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const lines = [
|
|
215
|
+
"# Loaded Specifications",
|
|
216
|
+
"",
|
|
217
|
+
"| # | Name | Title | Version | Source |",
|
|
218
|
+
"|---|------|-------|---------|--------|",
|
|
219
|
+
];
|
|
220
|
+
for (let i = 0; i < specs.length; i++) {
|
|
221
|
+
lines.push(`| ${i + 1} | \`${specs[i].name}\` | ${specs[i].title} | ${specs[i].version} | \`${specs[i].source}\` |`);
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
225
|
+
structuredContent: { loaded: specs },
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
return {
|
|
230
|
+
content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
server.registerTool("swagger_remove_spec", {
|
|
235
|
+
title: "Remove Loaded Spec",
|
|
236
|
+
description: `Remove a loaded OpenAPI/Swagger specification from memory.
|
|
237
|
+
|
|
238
|
+
Use this tool to free up memory or reload a spec that has changed.
|
|
239
|
+
|
|
240
|
+
Args:
|
|
241
|
+
- spec_name (string): Name of the spec to remove
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
Confirmation message.
|
|
245
|
+
|
|
246
|
+
Examples:
|
|
247
|
+
- Use when: "Remove the Petstore API spec" -> params with spec_name="Petstore v1.0.0"
|
|
248
|
+
- Use when: "Unload the internal API spec" -> params with spec_name="Internal API v2.0"
|
|
249
|
+
|
|
250
|
+
Error Handling:
|
|
251
|
+
- Returns error if the spec name is not found`,
|
|
252
|
+
inputSchema: z.object({
|
|
253
|
+
spec_name: z.string().min(1).describe("Name of the spec to remove (use swagger_list_loaded to see available names)"),
|
|
254
|
+
}).strict(),
|
|
255
|
+
annotations: {
|
|
256
|
+
readOnlyHint: false,
|
|
257
|
+
destructiveHint: true,
|
|
258
|
+
idempotentHint: false,
|
|
259
|
+
openWorldHint: false,
|
|
260
|
+
},
|
|
261
|
+
}, async (params) => {
|
|
262
|
+
try {
|
|
263
|
+
if (!isLoaded(params.spec_name)) {
|
|
264
|
+
return { content: [{ type: "text", text: `Error: Spec '${params.spec_name}' not found. Use swagger_list_loaded to see available specs.` }] };
|
|
265
|
+
}
|
|
266
|
+
removeSpec(params.spec_name);
|
|
267
|
+
return {
|
|
268
|
+
content: [{ type: "text", text: `Removed spec: \`${params.spec_name}\`` }],
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
return {
|
|
273
|
+
content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }],
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=load-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-spec.js","sourceRoot":"","sources":["../../src/tools/load-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEzK,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sEA6BmD;QAChE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,4FAA4F,CAAC;YAC5H,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uJAAuJ,CAAC;SACrM,CAAC,CAAC,MAAM,EAAE;QACX,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,KAAK;YACrB,aAAa,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OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,MAAM,CAAC,SAAS,8DAA8D,EAAE,CAAC,EAAE,CAAC;YAC/I,CAAC;YAED,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC7B,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;aAC3E,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;aAC1F,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/tools/paths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QA2OnD"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CHARACTER_LIMIT } from "../constants.js";
|
|
3
|
+
import { isLoaded, getEndpoints, getEndpointDetail, getPathParameterNames, getSpec, getTags } from "../services/swagger-service.js";
|
|
4
|
+
import { formatEndpointDetail } from "../formatters.js";
|
|
5
|
+
export function registerPathsTools(server) {
|
|
6
|
+
server.registerTool("swagger_list_paths", {
|
|
7
|
+
title: "List API Endpoints",
|
|
8
|
+
description: `List all API endpoints (paths and HTTP methods) from a loaded OpenAPI spec, optionally filtered by tag.
|
|
9
|
+
|
|
10
|
+
Use this tool to get a high-level overview of all available API operations. Results can be filtered by tag for progressive exploration.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
- spec_name (string): Name of the previously loaded spec
|
|
14
|
+
- tag (string, optional): Filter endpoints by this tag/group name
|
|
15
|
+
- limit (number): Maximum results to return, between 1-200 (default: 50)
|
|
16
|
+
- offset (number): Number of results to skip for pagination (default: 0)
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
{
|
|
20
|
+
"total": number, // Total number of matching endpoints
|
|
21
|
+
"count": number, // Number of results in this response
|
|
22
|
+
"offset": number, // Current pagination offset
|
|
23
|
+
"endpoints": [...],
|
|
24
|
+
"has_more": boolean,
|
|
25
|
+
"next_offset": number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
- Use when: "Show me all endpoints" -> params with spec_name="<name>"
|
|
30
|
+
- Use when: "List all user-related endpoints" -> params with spec_name="<name>", tag="users"
|
|
31
|
+
|
|
32
|
+
Error Handling:
|
|
33
|
+
- Returns error if the spec name has not been loaded yet`,
|
|
34
|
+
inputSchema: z.object({
|
|
35
|
+
spec_name: z.string().min(1).describe("Name of the previously loaded OpenAPI/Swagger spec (use swagger_list_loaded to see available names)"),
|
|
36
|
+
tag: z.string().optional().describe("Filter endpoints by tag/group name (e.g., 'users', 'pets', 'store'). Use swagger_list_tags to see available tags."),
|
|
37
|
+
limit: z.number().int().min(1).max(200).default(50).describe("Maximum results to return (default: 50, max: 200)"),
|
|
38
|
+
offset: z.number().int().min(0).default(0).describe("Number of results to skip for pagination (default: 0)"),
|
|
39
|
+
}).strict(),
|
|
40
|
+
annotations: {
|
|
41
|
+
readOnlyHint: true,
|
|
42
|
+
destructiveHint: false,
|
|
43
|
+
idempotentHint: true,
|
|
44
|
+
openWorldHint: false,
|
|
45
|
+
},
|
|
46
|
+
}, async (params) => {
|
|
47
|
+
try {
|
|
48
|
+
if (!isLoaded(params.spec_name)) {
|
|
49
|
+
return { content: [{ type: "text", text: `Error: Spec '${params.spec_name}' has not been loaded yet. Use swagger_load_spec to load it first.` }] };
|
|
50
|
+
}
|
|
51
|
+
const allEndpoints = getEndpoints(params.spec_name, params.tag);
|
|
52
|
+
const total = allEndpoints.length;
|
|
53
|
+
const paginated = allEndpoints.slice(params.offset, params.offset + params.limit);
|
|
54
|
+
if (paginated.length === 0) {
|
|
55
|
+
return {
|
|
56
|
+
content: [{
|
|
57
|
+
type: "text",
|
|
58
|
+
text: total === 0
|
|
59
|
+
? `No endpoints found${params.tag ? ` for tag '${params.tag}'` : ""} in the spec.`
|
|
60
|
+
: `No more endpoints to show (showing ${params.offset} of ${total}).`,
|
|
61
|
+
}],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const hasMore = total > params.offset + paginated.length;
|
|
65
|
+
const tags = getTags(params.spec_name);
|
|
66
|
+
const store = getSpec(params.spec_name);
|
|
67
|
+
const output = {
|
|
68
|
+
total,
|
|
69
|
+
count: paginated.length,
|
|
70
|
+
offset: params.offset,
|
|
71
|
+
endpoints: paginated,
|
|
72
|
+
has_more: hasMore,
|
|
73
|
+
...(hasMore ? { next_offset: params.offset + paginated.length } : {}),
|
|
74
|
+
};
|
|
75
|
+
const lines = [];
|
|
76
|
+
lines.push(`# ${store?.spec.info.title || "API"} - Endpoints`);
|
|
77
|
+
if (params.tag) {
|
|
78
|
+
lines.push(`\nFiltered by tag: \`${params.tag}\``);
|
|
79
|
+
}
|
|
80
|
+
lines.push(`\n**${total} total endpoints** (showing ${paginated.length})`);
|
|
81
|
+
lines.push("");
|
|
82
|
+
for (const ep of paginated) {
|
|
83
|
+
const deprecationBadge = ep.deprecated ? " ~~(deprecated)~~" : "";
|
|
84
|
+
lines.push(`### \`${ep.method.toUpperCase()}\` ${ep.path}${deprecationBadge}`);
|
|
85
|
+
if (ep.summary)
|
|
86
|
+
lines.push(`${ep.summary}`);
|
|
87
|
+
if (ep.operationId)
|
|
88
|
+
lines.push(`- Operation ID: \`${ep.operationId}\``);
|
|
89
|
+
if (ep.tags.length > 0)
|
|
90
|
+
lines.push(`- Tags: ${ep.tags.map((t) => `\`${t}\``).join(", ")}`);
|
|
91
|
+
lines.push("");
|
|
92
|
+
}
|
|
93
|
+
if (hasMore) {
|
|
94
|
+
lines.push(`> Showing ${paginated.length} of ${total} endpoints. Use offset=${params.offset + paginated.length} to see more.`);
|
|
95
|
+
}
|
|
96
|
+
if (tags.length > 0 && !params.tag) {
|
|
97
|
+
lines.push("---");
|
|
98
|
+
lines.push("## Available Tags");
|
|
99
|
+
lines.push("Use the `tag` parameter to filter by group:");
|
|
100
|
+
lines.push("");
|
|
101
|
+
for (const tag of tags) {
|
|
102
|
+
lines.push(`- \`${tag.name}\` (${tag.count} endpoints)`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let textContent = lines.join("\n");
|
|
106
|
+
if (textContent.length > CHARACTER_LIMIT) {
|
|
107
|
+
textContent = textContent.slice(0, CHARACTER_LIMIT) + "\n\n... (truncated)";
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
content: [{ type: "text", text: textContent }],
|
|
111
|
+
structuredContent: output,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }] };
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
server.registerTool("swagger_get_endpoint", {
|
|
119
|
+
title: "Get Endpoint Details",
|
|
120
|
+
description: `Get detailed information about a specific API endpoint, including parameters, request body, responses, and security requirements.
|
|
121
|
+
|
|
122
|
+
Use this tool after swagger_list_paths to drill down into a specific endpoint's complete details.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
- spec_name (string): Name of the previously loaded spec
|
|
126
|
+
- path (string): URL path of the endpoint (e.g., "/pets/{petId}")
|
|
127
|
+
- method (string): HTTP method (get, post, put, patch, delete, options, head)
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Full endpoint details with parameters, request body, responses, and security.
|
|
131
|
+
|
|
132
|
+
Examples:
|
|
133
|
+
- Use when: "Show me the details of GET /pets/{petId}" -> params with spec_name="<name>", path="/pets/{petId}", method="get"
|
|
134
|
+
- Use when: "What parameters does the create user endpoint take?" -> params with spec_name="<name>", path="/users", method="post"
|
|
135
|
+
|
|
136
|
+
Error Handling:
|
|
137
|
+
- Returns error if the spec name has not been loaded
|
|
138
|
+
- Returns error if the path or method is not found, with suggestions`,
|
|
139
|
+
inputSchema: z.object({
|
|
140
|
+
spec_name: z.string().min(1).describe("Name of the previously loaded OpenAPI/Swagger spec (use swagger_list_loaded to see available names)"),
|
|
141
|
+
path: z.string().describe("URL path of the endpoint (e.g., '/pets/{petId}', '/users', '/store/order'). Must start with '/'."),
|
|
142
|
+
method: z.enum(["get", "post", "put", "patch", "delete", "options", "head"]).describe("HTTP method (get, post, put, patch, delete, options, head)"),
|
|
143
|
+
}).strict(),
|
|
144
|
+
annotations: {
|
|
145
|
+
readOnlyHint: true,
|
|
146
|
+
destructiveHint: false,
|
|
147
|
+
idempotentHint: true,
|
|
148
|
+
openWorldHint: false,
|
|
149
|
+
},
|
|
150
|
+
}, async (params) => {
|
|
151
|
+
try {
|
|
152
|
+
if (!isLoaded(params.spec_name)) {
|
|
153
|
+
return { content: [{ type: "text", text: `Error: Spec '${params.spec_name}' has not been loaded yet. Use swagger_load_spec to load it first.` }] };
|
|
154
|
+
}
|
|
155
|
+
const detail = getEndpointDetail(params.spec_name, params.path, params.method);
|
|
156
|
+
if (!detail) {
|
|
157
|
+
const allEndpoints = getEndpoints(params.spec_name);
|
|
158
|
+
const similarPaths = allEndpoints
|
|
159
|
+
.filter((ep) => ep.path.includes(params.path) || params.path.includes(ep.path))
|
|
160
|
+
.slice(0, 5);
|
|
161
|
+
let suggestion = "";
|
|
162
|
+
if (similarPaths.length > 0) {
|
|
163
|
+
suggestion = `\n\nDid you mean one of these?\n${similarPaths.map((ep) => ` - ${ep.method.toUpperCase()} ${ep.path}`).join("\n")}`;
|
|
164
|
+
}
|
|
165
|
+
return { content: [{ type: "text", text: `Error: No ${params.method.toUpperCase()} operation found for path '${params.path}'.${suggestion}` }] };
|
|
166
|
+
}
|
|
167
|
+
const paramNames = getPathParameterNames(params.path);
|
|
168
|
+
const mergedParameters = [
|
|
169
|
+
...paramNames.map((name) => {
|
|
170
|
+
const existingParam = (detail.parameters || []).find((p) => p.name === name);
|
|
171
|
+
if (existingParam)
|
|
172
|
+
return existingParam;
|
|
173
|
+
return { name, in: "path", required: true, description: `Path parameter: ${name}`, schema: { type: "string" } };
|
|
174
|
+
}),
|
|
175
|
+
...(detail.parameters || []).filter((p) => !paramNames.includes(p.name)),
|
|
176
|
+
];
|
|
177
|
+
const endpointInfo = {
|
|
178
|
+
path: params.path,
|
|
179
|
+
method: params.method,
|
|
180
|
+
summary: detail.summary,
|
|
181
|
+
description: detail.description,
|
|
182
|
+
operationId: detail.operationId,
|
|
183
|
+
tags: detail.tags || [],
|
|
184
|
+
deprecated: detail.deprecated || false,
|
|
185
|
+
parameters: mergedParameters,
|
|
186
|
+
requestBody: detail.requestBody
|
|
187
|
+
? {
|
|
188
|
+
description: detail.requestBody.description,
|
|
189
|
+
required: detail.requestBody.required,
|
|
190
|
+
content: Object.fromEntries(Object.entries(detail.requestBody.content).map(([ct, mt]) => [ct, { schema: mt.schema }])),
|
|
191
|
+
}
|
|
192
|
+
: undefined,
|
|
193
|
+
responses: detail.responses
|
|
194
|
+
? Object.fromEntries(Object.entries(detail.responses).map(([code, resp]) => [
|
|
195
|
+
code,
|
|
196
|
+
{
|
|
197
|
+
description: resp.description,
|
|
198
|
+
content: resp.content
|
|
199
|
+
? Object.fromEntries(Object.entries(resp.content).map(([ct, mt]) => [ct, { schema: mt.schema }]))
|
|
200
|
+
: undefined,
|
|
201
|
+
},
|
|
202
|
+
]))
|
|
203
|
+
: undefined,
|
|
204
|
+
security: detail.security,
|
|
205
|
+
};
|
|
206
|
+
return {
|
|
207
|
+
content: [{ type: "text", text: formatEndpointDetail(endpointInfo) }],
|
|
208
|
+
structuredContent: endpointInfo,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }] };
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/tools/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACpI,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;2DAyBwC;QACrD,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qGAAqG,CAAC;YAC5I,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mHAAmH,CAAC;YACxJ,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,mDAAmD,CAAC;YACjH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,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