Generate Tool
Turn a Python script or natural language description into a fully parameterized ArcGIS Python toolbox (.pyt). The tool handles boilerplate, parameter inference, and packaging so you can focus on logic.
Overview
Generate Tool accepts either raw Python code or a descriptive prompt. The AI drafts the tool class, parameter definitions, and execute logic, then writes a ready-to-use .pyt file.
Usage
- Add the toolbox to ArcGIS Pro.
- Open Generate Tool.
- Choose whether you are supplying code or a natural language prompt.
- Set toolbox name, tool name, and output folder.
- Optionally enable advanced mode to provide explicit parameter JSON.
- Run the tool. A .pyt file is created and ready to add to ArcGIS Pro.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| Source | String (Choice) | Yes | AI provider (OpenRouter, OpenAI, Azure OpenAI, Claude, DeepSeek, Local LLM). |
| Model | String | No | Specific model for the provider. |
| Endpoint | String | No | Custom endpoint for Azure or local deployments. |
| Deployment Name | String | No | Azure OpenAI deployment ID. |
| Input Type | String (Choice) | Yes | Use "Natural Language Prompt" or "Python Code". |
| Python Code | String (Multiline) | No | Paste existing code when Input Type = Python Code. |
| Natural Language Prompt | String | No | Describe the tool you want when Input Type = Prompt. |
| Toolbox Name | String | Yes | Name for the generated toolbox. |
| Tool Name | String | Yes | Class name for the generated tool. |
| Output Path | Folder | Yes | Directory where the .pyt file will be saved. |
| Advanced Mode | Boolean | No | Enable to supply custom parameter JSON. |
| Parameter Definition (JSON) | String (Multiline) | No | Only used with Advanced Mode. |
| Output Toolbox | File (Derived) | Auto | Path to the generated .pyt. |
How it works
- Input processing: Prompts are converted to Python; existing code is used as-is.
- Parameter inference: The AI inspects the code to infer parameters and properties.
- Toolbox generation: A complete .pyt is written with the correct ArcGIS class structure.
- Validation: Syntax and structure are checked before writing the file.
Tips
- Describe inputs, outputs, and edge cases explicitly.
- Use descriptive toolbox/tool names for clarity.
- Test the output .pyt before distributing it.
- Iterate by refining your prompt or code if the first attempt needs adjustment.
Advanced parameter definition
When Advanced Mode is enabled, provide JSON to control parameters. Example:
{
"parameters": [
{
"name": "input_layer",
"displayName": "Input Feature Layer",
"datatype": "GPFeatureLayer",
"parameterType": "Required",
"direction": "Input"
},
{
"name": "buffer_distance",
"displayName": "Buffer Distance",
"datatype": "GPLinearUnit",
"parameterType": "Required",
"direction": "Input"
},
{
"name": "output_layer",
"displayName": "Output Feature Layer",
"datatype": "GPFeatureLayer",
"parameterType": "Required",
"direction": "Output"
}
]
}
Example uses
- Convert a standalone script into a reusable tool for your team.
- Prototype specialized geoprocessing workflows quickly.
- Package automation utilities with proper parameters.
Data privacy
Important: The code or prompt you provide is sent to the AI provider. Avoid sharing proprietary algorithms or sensitive data unless you are using a trusted, local model.