collection_get
Retrieve complete details of a saved HTTP request by its name for API testing and collection management.
Instructions
Obtiene los detalles completos de un request guardado por su nombre.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>"
},
"name": "collection_get"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Nombre del request guardado |
Implementation Reference
- src/tools/collection.ts:98-137 (handler)The handler for collection_get: takes a 'name' string parameter, calls storage.getCollection(name) to retrieve the saved request, returns JSON-stringified details on success, or an error message if not found.
// ── collection_get ── server.tool( 'collection_get', 'Obtiene los detalles completos de un request guardado por su nombre.', { name: z.string().describe('Nombre del request guardado'), }, async (params) => { try { const saved = await storage.getCollection(params.name) if (!saved) { return { content: [ { type: 'text' as const, text: `Request '${params.name}' no encontrado`, }, ], isError: true, } } return { content: [ { type: 'text' as const, text: JSON.stringify(saved, null, 2), }, ], } } catch (error) { const message = error instanceof Error ? error.message : String(error) return { content: [{ type: 'text' as const, text: `Error: ${message}` }], isError: true, } } }, ) - src/tools/collection.ts:102-104 (schema)Input schema for collection_get: a single 'name' string parameter describing the saved request name.
{ name: z.string().describe('Nombre del request guardado'), }, - src/tools/collection.ts:99-137 (registration)Registration of collection_get tool via server.tool() with name 'collection_get' and description.
server.tool( 'collection_get', 'Obtiene los detalles completos de un request guardado por su nombre.', { name: z.string().describe('Nombre del request guardado'), }, async (params) => { try { const saved = await storage.getCollection(params.name) if (!saved) { return { content: [ { type: 'text' as const, text: `Request '${params.name}' no encontrado`, }, ], isError: true, } } return { content: [ { type: 'text' as const, text: JSON.stringify(saved, null, 2), }, ], } } catch (error) { const message = error instanceof Error ? error.message : String(error) return { content: [{ type: 'text' as const, text: `Error: ${message}` }], isError: true, } } }, ) - src/lib/storage.ts:72-75 (handler)The storage helper method that reads a saved request from the filesystem by sanitizing the name and reading the JSON file from the collections directory.
async getCollection(name: string): Promise<SavedRequest | null> { const filePath = join(this.collectionsDir, `${this.sanitizeName(name)}.json`) return this.readJson<SavedRequest>(filePath) }