getEnabledTools
When a requested tool is unavailable, discover which tools are enabled in the full and minimal tool sets to find available alternatives.
Instructions
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/getEnabledTools.ts:20-64 (handler)The handler function for the getEnabledTools tool. It returns server context info (server type, available tools) and lists all enabled tools across full, minimal, and excludedFromGeneration sets plus stats.
export async function handler( _args: z.infer<typeof parameters>, extra: { client: PostmanAPIClient; headers?: IsomorphicHeaders; serverContext?: ServerContext } ): Promise<CallToolResult> { 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: unknown) { if (e instanceof McpError) { throw e; } throw asMcpError(e); } } - src/tools/getEnabledTools.ts:11-11 (schema)Schema for getEnabledTools - takes no parameters (empty Zod object).
export const parameters = z.object({}); - src/index.ts:254-371 (registration)All tools (including getEnabledTools) are dynamically discovered by loadAllTools() which imports every .ts/.js file from src/tools/. The module must export method, description, parameters, and handler. They are then registered via server.registerTool().
for (const tool of tools) { server.registerTool( tool.method, { description: tool.description, inputSchema: tool.parameters.shape, annotations: tool.annotations || {}, }, async (args, extra) => { const toolName = tool.method; // Keep start event on stderr only to reduce client noise log('info', `Tool invocation started: ${toolName}`, { toolName }); try { const start = Date.now(); const result = await tool.handler(args, { client, headers: { ...extra?.requestInfo?.headers, 'user-agent': clientInfo?.name, }, serverContext, }); const durationMs = Date.now() - start; // Completion: stderr only to avoid spamming client logs log('info', `Tool invocation completed: ${toolName} (${durationMs}ms)`, { toolName, durationMs, }); // Apply template rendering if (result.content?.[0]?.type === 'text') { const rendered = renderTemplate(toolName, result.content[0].text); if (rendered) { return { content: [{ type: 'text' as const, text: rendered }] }; } } return result; } catch (error: any) { const errMsg = String(error?.message || error); // Failures: notify both server stderr and client logBoth(server, 'error', `Tool invocation failed: ${toolName}: ${errMsg}`, { toolName }); if (error instanceof McpError) { const httpStatus = (error.data as Record<string, unknown>)?.httpStatus; if (typeof httpStatus === 'number') { const rawBody = String((error.data as Record<string, unknown>)?.cause ?? ''); let parsedBody: Record<string, unknown> | null = null; try { parsedBody = JSON.parse(rawBody) as Record<string, unknown>; } catch { /* not JSON */ } // Unwrap common { error: { ... } } API response pattern const errorObj = parsedBody?.error && typeof parsedBody.error === 'object' ? (parsedBody.error as Record<string, unknown>) : parsedBody; const rendered = renderErrorTemplate(toolName, httpStatus, { toolName, statusCode: httpStatus, args, errorMessage: error.message, errorBody: rawBody, error: errorObj, }); if (rendered) { throw new McpError(error.code, rendered, error.data); } } throw error; } throw new McpError(ErrorCode.InternalError, `API error: ${error.message}`); } } ); } if (instructionsContent) { server.registerResource( 'instructions', 'postman://instructions', { description: 'Instructions for using the Postman MCP server', mimeType: 'text/markdown' }, async (uri) => ({ contents: [{ uri: uri.href, mimeType: 'text/markdown', text: instructionsContent }], }) ); log('info', 'Registered resource: instructions'); } // API key validation is handled by the singleton client log('info', 'Starting stdio transport'); const transport = new StdioServerTransport(); transport.onmessage = (message) => { if (isInitializeRequest(message)) { clientInfo = message.params.clientInfo; log('debug', '📥 Received MCP initialize request', { clientInfo }); } }; await server.connect(transport); const toolsetName = useCode ? 'code' : useFull ? 'full' : 'minimal'; logBoth( server, 'info', `Server connected and ready: ${SERVER_NAME}@${APP_VERSION} with ${tools.length} tools (${toolsetName})` ); } run().catch((error: unknown) => { log('error', 'Unhandled error during server execution', { error: String((error as any)?.message || error), }); process.exit(1); }); - src/enabledResources.ts:1-301 (helper)EnabledResources defines which tools belong to which set. getEnabledTools is included in both 'full' (line 157) and 'minimal' (line 216) sets, and also in 'excludedFromGeneration' (line 250), meaning it's hand-written, not auto-generated from an API spec.
const full = [ // Collections 'createCollection', 'deleteCollection', 'generateCollection', 'getCollection', 'getCollections', 'patchCollection', 'putCollection', 'getCollectionTags', 'updateCollectionTags', 'getCollectionUpdatesTasks', 'syncCollectionWithSpec', 'syncSpecWithCollection', 'generateSpecFromCollection', 'getGeneratedCollectionSpecs', 'getSpecCollections', // Collection Forks 'getCollectionForks', 'getSourceCollectionStatus', 'getCollectionsForkedByUser', 'pullCollectionChanges', 'createCollectionFork', 'mergeCollectionFork', // Collection Folders 'createCollectionFolder', 'deleteCollectionFolder', 'getCollectionFolder', 'updateCollectionFolder', 'transferCollectionFolders', // Collection Requests 'createCollectionRequest', 'deleteCollectionRequest', 'getCollectionRequest', 'updateCollectionRequest', 'transferCollectionRequests', // Collection Responses 'createCollectionResponse', 'deleteCollectionResponse', 'getCollectionResponse', 'updateCollectionResponse', 'transferCollectionResponses', // Collection Runner 'runCollection', // Comments 'createCollectionComment', 'deleteCollectionComment', 'getCollectionComments', 'updateCollectionComment', 'updateApiCollectionComment', 'createFolderComment', 'deleteFolderComment', 'getFolderComments', 'updateFolderComment', 'createRequestComment', 'deleteRequestComment', 'getRequestComments', 'updateRequestComment', 'createResponseComment', 'deleteResponseComment', 'getResponseComments', 'updateResponseComment', 'resolveCommentThread', // Environments 'createEnvironment', 'deleteEnvironment', 'getEnvironment', 'getEnvironments', 'patchEnvironment', 'putEnvironment', // Mocks 'createMock', 'deleteMock', 'getMock', 'getMocks', 'updateMock', 'publishMock', 'unpublishMock', // Monitors 'createMonitor', 'deleteMonitor', 'getMonitor', 'getMonitors', 'updateMonitor', 'runMonitor', // Specs 'createSpec', 'deleteSpec', 'getSpec', 'getAllSpecs', 'getSpecDefinition', 'updateSpecProperties', 'createSpecFile', 'getSpecFile', 'getSpecFiles', 'updateSpecFile', // Workspaces 'createWorkspace', 'deleteWorkspace', 'getWorkspace', 'getWorkspaces', 'updateWorkspace', 'getWorkspaceGlobalVariables', 'updateWorkspaceGlobalVariables', 'getWorkspaceTags', 'updateWorkspaceTags', // PAN (Private API Network) 'listPrivateNetworkWorkspaces', 'listPrivateNetworkAddRequests', 'removeWorkspaceFromPrivateNetwork', 'addWorkspaceToPrivateNetwork', 'respondPrivateNetworkAddRequest', // // Documentation 'publishDocumentation', 'unpublishDocumentation', // Tasks and Status 'getAsyncSpecTaskStatus', 'getStatusOfAnAsyncApiTask', // User and Tags 'getAuthenticatedUser', 'getTaggedEntities', // Instructions 'getCodeGenerationInstructions', 'getPostmanContextOverview', 'getApiDiscoveryInstructions', 'getInstalledApiMaintenanceInstructions', // Transfer 'transferCollectionFolders', 'transferCollectionResponses', 'transferCollectionResponses', // 'asyncMergePullCollectionFork' skipped // 'asyncMergePullCollectionTaskStatus' skipped // Duplicate Collection 'duplicateCollection', 'getDuplicateCollectionTaskStatus', 'deleteApiCollectionComment', 'deleteSpecFile', 'getEnabledTools', 'searchPostmanElements', // Analytics 'getAnalyticsData', 'getAnalyticsMetadata', // Context (AI-optimized markdown views) 'getCollectionContext', 'getFolderContext', 'getRequestContext', 'getResponseContext', 'getRequestCodeContext', 'getEnvironmentContext', 'getWorkspacesContext', 'getWorkspaceContext', 'getWorkspaceEnvironmentsContext', ] as const; const minimal = [ 'createCollection', 'createEnvironment', 'createMock', 'createSpec', 'createSpecFile', 'createWorkspace', 'generateCollection', 'generateSpecFromCollection', 'getAllSpecs', 'getAuthenticatedUser', 'getCollection', 'getCollections', 'getEnvironment', 'getEnvironments', 'getGeneratedCollectionSpecs', 'getMock', 'getMocks', 'getSpec', 'getSpecCollections', 'getSpecDefinition', 'getSpecFile', 'getSpecFiles', 'getTaggedEntities', 'getWorkspace', 'getWorkspaces', 'publishMock', 'putCollection', 'putEnvironment', 'syncCollectionWithSpec', 'syncSpecWithCollection', 'updateMock', 'updateSpecFile', 'updateSpecProperties', 'updateWorkspace', 'createCollectionRequest', 'createCollectionResponse', 'duplicateCollection', 'getDuplicateCollectionTaskStatus', 'runCollection', 'getEnabledTools', 'updateCollectionRequest', ] as const; const code = [ 'getCodeGenerationInstructions', 'getPostmanContextOverview', 'getApiDiscoveryInstructions', 'getInstalledApiMaintenanceInstructions', 'getWorkspace', 'getWorkspaces', 'searchPostmanElements', 'getCollectionRequest', 'getCollectionResponse', 'getCollectionFolder', 'getAuthenticatedUser', 'getCollection', 'getEnvironment', 'getEnvironments', 'searchPostmanElementsInPrivateNetwork', // Context tools (AI-optimized markdown views) 'getCollectionContext', 'getFolderContext', 'getRequestContext', 'getResponseContext', 'getRequestCodeContext', 'getEnvironmentContext', 'getWorkspacesContext', 'getWorkspaceContext', 'getWorkspaceEnvironmentsContext', ] as const; const excludedFromGeneration = [ 'runCollection', 'getEnabledTools', 'getCodeGenerationInstructions', 'getPostmanContextOverview', 'getApiDiscoveryInstructions', 'getInstalledApiMaintenanceInstructions', 'getCollectionMap', 'getCollection', 'searchPostmanElements', 'searchPostmanElementsInPublicNetwork', 'searchPostmanElementsInPrivateNetwork', // Context tools (hand-written, not generated from spec) 'getCollectionContext', 'getFolderContext', 'getRequestContext', 'getResponseContext', 'getRequestCodeContext', 'getEnvironmentContext', 'getWorkspacesContext', 'getWorkspaceContext', 'getWorkspaceEnvironmentsContext', ] as const; /** * Subtools are tools that are grouped under a parent tool orchestrator. * Each subtool is defined with: * - orchestrator: The main tool that will be exposed (the index.ts file) * - subtools: Array of tools that will be placed in the orchestrator's folder * * Example structure for 'getCollection': * tools/ * getCollection/ * index.ts <- orchestrator (handles routing logic) * getCollection.ts <- subtool (the actual API call) * getCollectionMap.ts <- subtool (the map variant) */ const subtools = { getCollection: { orchestrator: 'getCollection', subtools: ['getCollection', 'getCollectionMap'], }, } as const; const templated = ['getCollections', 'getWorkspaces'] as const; export const enabledResources = { full, minimal, code, excludedFromGeneration, subtools, templated, };