AI assistant — Custom function
A guided prompt that collects what a custom function needs to do, then generates the C# method body and the [CustomFunction] attribute — ready to save into the Custom Functions UI.
Custom functions look simple but they’re sensitive to two kinds of detail the assistant can’t infer: the exact signature the call sites expect, and any external dependencies (a database, a third-party API, a NuGet package) the function will reach out to. The guided mode collects both before generating any code.
What this mode builds
A complete custom function — the C# method body, the [CustomFunction("fnX")] attribute, the parameter and return types, any required using statements — ready to save into the Custom Functions UI. The result is reviewed and saved by you; the assistant does not deploy it.
What the guided form collects
The form asks for the facts the assistant cannot infer:
- The function name — the [CustomFunction] token callers will reference.
- The parameters — name, type, and what each one represents.
- The return type — and what an empty / null / error result should look like.
- The behaviour — described in plain language, including edge cases.
- Any external dependencies — database connection, HTTP endpoint, NuGet package — and how they should be configured (parameter vs. hardcoded).
- Where the function will be called from — map, port property, pipeline component property, or routing expression — so the assistant can shape error handling appropriately for the call site.
When to use it vs free-form
Use this guided mode whenever the task is “write me a custom function that does X.” Use free-form when the request is broader — for example, generating a custom function and the map that calls it in the same prompt — or when you want to discuss naming or design before any code is generated.
Limits
The generated function still needs review. Things the assistant can’t verify on your behalf: that a connection string actually reaches the target database from the runtime, that a NuGet package version is the one already in the platform catalogue, that the error-handling path returns a value any caller can safely consume. Treat the output as a first draft and exercise it with representative inputs before relying on it in production.