@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)
54 lines (53 loc) • 2.3 kB
JavaScript
import { z } from 'zod';
import { enabledResources } from '../enabledResources.js';
import { asMcpError, McpError, defineToolAnnotations } from './utils/toolHelpers.js';
export const method = 'getEnabledTools';
export const title = 'Get enabled tools';
export const description = 'IMPORTANT: Run this tool first when a requested tool is unavailable. Returns information about which tools are enabled in the full and minimal tool sets, helping you identify available alternatives.';
export const parameters = z.object({});
export const annotations = defineToolAnnotations({
title: 'Get enabled tools',
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
});
export async function handler(_args, extra) {
try {
return {
content: [
{
type: 'text',
text: JSON.stringify({
serverInfo: extra.serverContext
? {
serverType: extra.serverContext.serverType,
currentServerTools: extra.serverContext.availableTools,
currentServerToolCount: extra.serverContext.availableTools.length,
}
: {
serverType: 'unknown',
note: 'Server context not available',
},
enabledTools: {
full: Array.from(enabledResources.full),
minimal: Array.from(enabledResources.minimal),
excludedFromGeneration: Array.from(enabledResources.excludedFromGeneration),
},
stats: {
totalFull: enabledResources.full.length,
totalMinimal: enabledResources.minimal.length,
totalExcludedFromGeneration: enabledResources.excludedFromGeneration.length,
},
}, null, 2),
},
],
};
}
catch (e) {
if (e instanceof McpError) {
throw e;
}
throw asMcpError(e);
}
}