UNPKG

@postman/postman-mcp-server

Version:

Postman MCP Server — connect AI agents (Claude Code, Cursor, VS Code Copilot, Gemini CLI) to your Postman collections, specifications, and environments via Model Context Protocol (MCP)

31 lines (30 loc) • 1.18 kB
import { z } from 'zod'; import { asMcpError, McpError, defineToolAnnotations } from './utils/toolHelpers.js'; export const method = 'getFolderContext'; export const title = 'Get folder context'; export const description = 'Returns a markdown-formatted summary of a folder within a collection, including its metadata, description, and authentication settings.'; export const parameters = z.object({ collectionId: z.string().describe("The collection's ID."), folderId: z.string().describe("The folder's ID."), }); export const annotations = defineToolAnnotations({ title: 'Get folder context', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }); export async function handler(args, extra) { try { const result = await extra.client.get(`/context/collections/${encodeURIComponent(String(args.collectionId))}/folders/${encodeURIComponent(String(args.folderId))}`, { headers: extra.headers }); return { content: [{ type: 'text', text: result }], }; } catch (e) { if (e instanceof McpError) { throw e; } throw asMcpError(e); } }