Skip to main content
Glama
giovannicocco

Postman Tool Generation MCP Server

generate_ai_tool

Generate AI agent tool code from Postman collections to integrate APIs with frameworks like OpenAI, LangChain, or Anthropic.

Instructions

Generate code for an AI agent tool using a Postman collection and request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionIdYesThe Public API Network collection ID
requestIdYesThe public request ID
languageYesProgramming language to use
agentFrameworkYesAI agent framework to use

Implementation Reference

  • The handler function that executes the generate_ai_tool logic: validates input parameters, makes a POST request to Postman API endpoint '/postbot/generations/tool', and returns the generated tool code or error.
    private async handleGenerateTool(args: any): Promise<any> { if (!args?.collectionId || !args?.requestId || !args?.language || !args?.agentFramework) { throw new McpError( ErrorCode.InvalidParams, 'Missing required parameters: collectionId, requestId, language, agentFramework' ); } try { const response = await this.axiosInstance.post('/postbot/generations/tool', { collectionId: args.collectionId, requestId: args.requestId, config: { language: args.language, agentFramework: args.agentFramework, }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { return { content: [ { type: 'text', text: `Error generating tool: ${error.response?.data?.error || error.message}`, }, ], isError: true, }; } throw error; } }
  • src/index.ts:65-92 (registration)
    Registration of the generate_ai_tool in the ListTools response, including name, description, and input schema.
    { name: 'generate_ai_tool', description: 'Generate code for an AI agent tool using a Postman collection and request', inputSchema: { type: 'object', properties: { collectionId: { type: 'string', description: 'The Public API Network collection ID', }, requestId: { type: 'string', description: 'The public request ID', }, language: { type: 'string', enum: ['javascript', 'typescript'], description: 'Programming language to use', }, agentFramework: { type: 'string', enum: ['openai', 'mistral', 'gemini', 'anthropic', 'langchain', 'autogen'], description: 'AI agent framework to use', }, }, required: ['collectionId', 'requestId', 'language', 'agentFramework'], }, },
  • src/index.ts:98-99 (registration)
    Dispatch in the CallToolRequest handler switch statement that routes to the generate_ai_tool handler.
    case 'generate_ai_tool': return this.handleGenerateTool(request.params.arguments);
  • Input schema definition for the generate_ai_tool tool parameters.
    inputSchema: { type: 'object', properties: { collectionId: { type: 'string', description: 'The Public API Network collection ID', }, requestId: { type: 'string', description: 'The public request ID', }, language: { type: 'string', enum: ['javascript', 'typescript'], description: 'Programming language to use', }, agentFramework: { type: 'string', enum: ['openai', 'mistral', 'gemini', 'anthropic', 'langchain', 'autogen'], description: 'AI agent framework to use', }, }, required: ['collectionId', 'requestId', 'language', 'agentFramework'], },
  • TypeScript interface defining the structure for GenerateToolConfig, matching the tool's input and API request body.
    interface GenerateToolConfig { collectionId: string; requestId: string; config: { language: 'javascript' | 'typescript'; agentFramework: 'openai' | 'mistral' | 'gemini' | 'anthropic' | 'langchain' | 'autogen'; }; }

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/giovannicocco/mcp-server-postman-tool-generation'

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