Skip to main content
Glama

getEnabledTools

Read-onlyIdempotent

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

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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);
      }
    }
  • 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);
    });
  • 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,
    };
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, destructiveHint, and idempotentHint as true. The description adds behavioral context beyond annotations by specifying the intended invocation order and the purpose of identifying alternatives. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with zero waste. The first sentence is an imperative instruction, the second explains the output. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given there are no parameters and no output schema, the description adequately covers the tool's purpose and usage. It could optionally describe the output format (e.g., list of tool names), but the current text is sufficient for a simple informational tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist in the input schema, so the description does not need to add parameter semantics. Baseline score of 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states what the tool does: returns information about enabled tools. It also provides a specific usage context: run it first when a requested tool is unavailable. This distinguishes it from all sibling tools which deal with collections, specs, etc.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says when to use the tool ('when a requested tool is unavailable') and what it helps with ('identifying available alternatives'). This is a direct and helpful usage guideline.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/postmanlabs/postman-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server