AI-Powered Creation
AI-Powered Creation is one of the most powerful features of MCP Functions. Instead of writing code from scratch, you describe what you want in plain English, and the AI generates complete, production-ready tool code. The platform supports streaming (real-time code as you type) and non-streaming (agent-based generation with optional web search). The AI can also generate or update the tool name, description, and parameters from your prompt.
What is AI-Powered Creation?
AI-Powered Creation uses advanced AI to understand your requirements and generate tool code. You don't need to know JavaScript or APIs. You describe what you want, and the AI does the rest. You can choose:
Streaming mode — See code appear in real time as the AI generates it.
Agent mode — Non-streaming; uses a LangGraph agent that can optionally use web search for up-to-date APIs and examples.
Generate parameters — Ask the AI to infer or update the tool's parameters, name, and description from your description.
This feature is revolutionary because it:
Eliminates the learning curve - You don't need to learn programming to create tools
Saves massive amounts of time - What would take hours or days of coding happens in seconds
Reduces errors - The AI generates code following best practices and security guidelines
Makes iteration fast - You can quickly try different approaches and see what works
Democratizes tool creation - Non-technical team members can create powerful tools
How to Use Natural Language Descriptions
Using AI-Powered Creation is simple: you describe what you want in plain English, just like you would explain it to a colleague. The AI understands your description and generates the complete tool.
The Basic Process
Navigate to your MCP server - Go to the MCP server where you want to create a tool
Click "Create Tool" - This opens the tool creation interface
Select "AI-Powered Creation" - Choose this option instead of manual creation
Describe your tool - Type a clear description of what you want the tool to do
Review the generated code - The AI generates complete code in seconds
Test and deploy - Test the tool, make any adjustments, and deploy it
Example Descriptions
Here are examples of good descriptions that produce excellent results:
Example 1: Weather Tool > "Create a tool that fetches the current weather for any city using the OpenWeatherMap API. The tool should take a city name as input and return the temperature in both Celsius and Fahrenheit, humidity percentage, weather conditions, and wind speed. Handle errors gracefully if the city is not found." This description is excellent because it: - Clearly states what the tool does (fetches weather) - Mentions the external API (OpenWeatherMap) - Specifies the input (city name) - Describes the expected outputs (temperature, humidity, conditions, wind speed) - Includes error handling requirements Example 2: Customer Lookup Tool > "Create a tool that looks up customer information from our database using an email address. It should connect to our REST API at https://api.example.com/customers, use the API key stored in workspace secrets as CUSTOMER_API_KEY, and return the customer's name, account status, and order history. Return an error if the customer is not found." This description works well because it: - Explains the purpose (customer lookup) - Specifies the input parameter (email address) - Provides the API endpoint - Mentions which secret to use - Describes what data to return - Includes error handling Example 3: Data Processing Tool > "Create a tool that calculates statistics from a list of numbers. It should accept an array of numbers as input and return the sum, average, maximum, minimum, and count. Handle empty arrays and invalid inputs gracefully."
Best Practices for Writing Descriptions
The quality of your description directly affects the quality of the generated code. Here are best practices to get the best results:
1. Be Specific About What the Tool Should Do
Vague descriptions produce vague results. Be as specific as possible:
Bad: "weather tool" - Too vague, doesn't explain what it does
Good: "Fetch current weather data for any city including temperature, humidity, and conditions" - Clear and specific
2. Mention External APIs or Services
If your tool needs to connect to external services, mention them explicitly:
Name the service (e.g., "OpenWeatherMap API", "Stripe API", "Slack API")
Provide the API endpoint if you know it
Mention any authentication requirements
3. Describe Expected Inputs and Outputs
Clearly describe what data the tool should accept and what it should return:
Inputs: "Takes a city name as a string" or "Accepts an email address and optional includeOrders boolean"
Outputs: "Returns customer name, email, and account status" or "Returns temperature in Celsius and Fahrenheit"
4. Include Special Requirements or Constraints
Mention any special requirements:
Error handling needs ("Handle errors gracefully", "Return error if not found")
Data validation ("Validate email format", "Ensure numbers are positive")
Format requirements ("Return dates in ISO format", "Format currency with dollar signs")
Performance requirements ("Should complete in under 2 seconds")
5. Mention Secrets or Configuration
If your tool needs to access workspace secrets, mention which ones:
"Use the API key stored in workspace secrets as STRIPE_API_KEY"
"Connect to the database using DATABASE_URL from secrets"
6. Provide Context When Helpful
Sometimes providing context helps the AI generate better code:
"This tool is for our customer support team"
"This integrates with our internal CRM system"
"This is part of our order processing workflow"
How Parameter Generation Works
One of the most impressive features of AI-Powered Creation is automatic parameter generation. The AI analyzes your description and automatically creates a parameter schema that tells AI assistants what inputs your tool needs.
What the AI Does Automatically
The AI automatically:
Infers parameter types - Determines whether each parameter should be a string, number, boolean, object, or array based on your description. For example, if you mention "city name", it creates a string parameter. If you mention "count", it creates a number parameter.
Creates descriptive parameter names - Generates clear, camelCase parameter names like "cityName", "customerEmail", or "includeOrders" that make sense in context.
Marks required vs optional parameters - Determines which parameters are essential and which are optional based on your description. If you say "takes a city name", it's required. If you say "optionally includes order history", it's optional.
Adds helpful descriptions - Creates parameter descriptions that explain what each parameter is for. These descriptions help AI assistants understand when and how to use your tool.
Adds validation rules - Infers validation requirements like email format, minimum/maximum values, or required string length.
Example: Automatic Parameter Generation
If you describe: "Create a tool that fetches customer data by email address, optionally including order history"
The AI might generate these parameters:
Notice how the AI: - Created appropriate parameter names (email, includeOrders) - Set correct types (string, boolean) - Marked email as required and includeOrders as optional - Added email format validation - Created helpful descriptions
Reviewing and Adjusting Parameters
After the AI generates parameters, you can review and adjust them:
Add or remove parameters
Change parameter types
Modify descriptions
Adjust validation rules
Change required/optional status
This gives you control while still benefiting from the AI's initial work.
Understanding the Code Generation Process
When you submit a description, the AI goes through a sophisticated process to generate your tool. Understanding this process helps you write better descriptions and know what to expect.
Step-by-Step Process
AI analyzes your description - The AI reads your description and identifies:
What the tool should do (the main functionality) - What inputs it needs (parameters) - What outputs it should produce - What external services it needs to connect to - Any special requirements or constraints
- **Generates appropriate parameter schema** - Based on the analysis, the AI creates a complete parameter schema that defines all inputs, their types, descriptions, and validation rules. - **Creates secure, sandboxed JavaScript code** - The AI generates complete JavaScript code that:
Implements the functionality you described - Follows security best practices - Handles errors gracefully - Validates inputs - Returns structured results - Uses workspace secrets securely
- **Validates code for security** - The generated code is automatically checked for:
Security vulnerabilities - Syntax errors - Best practice violations - Sandbox compliance
- **Makes the tool immediately available** - Once validated, the tool is ready to use. You can test it, deploy it, or make adjustments as needed. ### What Gets Generated
The AI generates complete, production-ready code including:
Function signature - The execute function with params and config parameters
Input validation - Code to validate that required parameters are provided and in the correct format
Error handling - Try-catch blocks and proper error messages
API integration - HTTP requests to external APIs with proper authentication
Data processing - Logic to process and transform data as needed
Return formatting - Structured return values with success/error indicators
You get a complete, working tool that you can use immediately or customize further.
Reviewing and Editing Generated Code
After the AI generates your tool, you have full control to review, modify, and improve it. The generated code is a starting point, not a final product.
What You Can Do After Generation
Review the generated code - Read through the code to understand what it does. Even if you're not a programmer, the code is usually well-commented and readable. This helps you verify that it matches your requirements.
Modify parameters if needed - Adjust the parameter schema if the AI didn't get it quite right. You can add parameters, remove them, change types, or modify descriptions.
Edit the code directly - If you're comfortable with JavaScript, you can edit the generated code to:
Add additional functionality - Improve error handling - Optimize performance - Add custom logic - Fix any issues
- **Test the tool before deploying** - Use the built-in testing interface to run your tool with sample inputs. This helps you verify it works correctly before making it available to AI assistants. - **Regenerate if needed** - If the generated code isn't quite right, you can modify your description and regenerate. Sometimes a small change in description produces much better results. ### Iterative Improvement
One of the powerful aspects of AI-Powered Creation is the ability to iterate quickly:
Generate an initial tool from your description
Test it and see what works and what doesn't
Refine your description or edit the code directly
Regenerate or update as needed
Repeat until you have exactly what you need
This iterative process is much faster than writing code from scratch, allowing you to experiment and refine your tools quickly.
When to Use Manual Editing
While AI-Powered Creation is powerful, sometimes you'll want to edit the code manually:
Complex logic - If you need very specific business logic that's hard to describe
Performance optimization - If you need to optimize for specific performance requirements
Integration with existing code - If you need to use specific libraries or patterns
Fine-tuning - If the generated code is 90% right but needs small adjustments
You can always start with AI generation and then switch to manual editing for fine-tuning.
Tips for Getting the Best Results
Start simple, then add complexity - Begin with a basic description, see what the AI generates, then refine with more details if needed.
Use examples in your description - Sometimes including an example helps: "Format dates like '2024-01-15'" or "Return currency like '$1,234.56'"
Mention error handling explicitly - If error handling is important, mention it: "Handle errors gracefully and return clear error messages"
Be specific about data formats - If you need specific formats, mention them: "Return dates in ISO 8601 format" or "Return numbers with 2 decimal places"
Don't be afraid to regenerate - If the first result isn't perfect, try refining your description and regenerating. Sometimes small wording changes produce much better results.
Combine AI generation with manual editing - Use AI to generate the bulk of the code, then manually edit to add specific requirements or optimizations.
Common Use Cases
AI-Powered Creation works excellently for:
API integrations - Connecting to external APIs like weather services, payment processors, or communication platforms
Data fetching - Retrieving data from databases, APIs, or other sources
Data transformation - Processing, formatting, or transforming data
Simple calculations - Performing calculations or computations
CRUD operations - Creating, reading, updating, or deleting records
Notifications - Sending emails, SMS, or other notifications
For most common use cases, AI-Powered Creation produces excellent results that work immediately or need only minor adjustments.
Last updated