POST https://<YOUR-FUNCTION-APP>.azurewebsites.net/api/chart?code=YOUR_API_KEY
Generates chart images using matplotlib. Returns a public URL to the PNG image. Call this tool when the user asks to create, plot, or visualize a chart or graph from data. Supported types: bar, line, pie, scatter, histogram, area, box, violin, heatmap. Supports single-series and multi-series (except pie and heatmap). After calling, display the URL as an image: 
Paste these into the description / instruction field for each input variable.
Required. One of: "bar", "line", "pie", "scatter", "histogram", "area", "box", "violin", "heatmap". Choose: "bar" for comparing categories, "line" for trends over time, "pie" for proportions, "scatter" for two-variable relationships, "histogram" for the distribution of one variable, "area" for cumulative/filled trends, "box" or "violin" for comparing distributions across groups, "heatmap" for a 2D matrix of values. Example: "show sales by region" -> "bar"; "trend over months" -> "line"; "response-time distribution by server" -> "box"; "correlation matrix" -> "heatmap".
Required. JSON object with the data to plot. Shape depends on chart_type.
Single-series: Bar/Pie {"labels":["A","B"],"values":[10,20]}. Line/Scatter/Area {"x":[1,2,3],"y":[10,20,30]}. Histogram {"values":[1,2,2,3,3]}. Box/Violin {"values":[[...],[...]],"labels":["A","B"]}. Heatmap {"matrix":[[1,2],[3,4]],"xlabels":["c1","c2"],"ylabels":["r1","r2"]}.
Multi-series (all except pie and heatmap): use "series" array. Bar: {"labels":["Q1","Q2"],"series":[{"name":"North","values":[10,20],"color":"steelblue"},{"name":"South","values":[15,25],"color":"coral"}]}. Line/Scatter/Area: {"series":[{"name":"2024","x":[1,2,3],"y":[10,20,30]},{"name":"2025","x":[1,2,3],"y":[15,25,35]}]}. Box/Violin: {"series":[{"name":"A","values":[1,2,3,4]},{"name":"B","values":[2,3,4,5]}]}. Each series can have "name", "color", and "marker" (line/scatter only).
Error bars (bar/line only): add "yerr" or "xerr" arrays at the series or top level.
Use numbers for values/x/y, strings for labels. Prefer multi-series when comparing groups.
Optional. JSON object for styling. All keys optional.
Titles/axes: "title" (always set when possible), "xlabel", "ylabel", "title_fontsize" (default 14), "label_fontsize" (default 12).
Theme/grid: "style" (one of "default","ggplot","seaborn-v0_8","dark_background","fivethirtyeight","bmh","grayscale"), "grid" (bool, default false).
Figure: "figsize_w" (default 8), "figsize_h" (default 6), "dpi" (default 150).
Scale/limits: "xscale"/"yscale" (one of "linear","log","symlog"), "xlim"/"ylim" (2-element arrays like [0,100]).
Color (single-series): "color" (e.g. "steelblue"), "colors" (array for pie slices), "marker" ("o","s","^").
Bar: "orientation" ("v" or "h"), "stacked" (bool), "bar_width" (default 0.8).
Area: "stacked" (bool), "alpha" (default 0.5).
Histogram: "bins" (default 10).
Pie: "autopct" (default "%1.1f%%").
Violin: "show_means" (bool), "show_medians" (bool, default true).
Heatmap: "cmap" (e.g. "viridis","plasma","coolwarm","RdBu_r"), "annotate" (bool).
Example: {"title":"Sales","xlabel":"Quarter","ylabel":"Revenue","style":"ggplot","grid":true,"yscale":"log"}
Public URL to the generated chart PNG image. Display as image: 
- Create a flow with trigger "Run a flow from Copilot" (or HTTP request)
- Add an HTTP action:
- Method: POST
- URI:
https://<YOUR-FUNCTION-APP>.azurewebsites.net/api/chart?code=YOUR_API_KEY - Headers: Content-Type = application/json
- Body:
{ "chart_type": "@{triggerBody()?['chart_type']}", "data": @{triggerBody()?['data']}, "params": @{triggerBody()?['params']} }
- Add a Parse JSON action on the HTTP response body:
{ "type": "object", "properties": { "url": { "type": "string" } } } - Add a Response action returning the parsed
url
- Go to your agent > Actions > + Add an action
- Select the Power Automate flow
- Paste the tool description above into the action description
- For each input variable, paste the matching variable instruction above
- Save & publish
Each user/agent gets their own API key. Create new keys with:
az functionapp keys set --resource-group <YOUR-RESOURCE-GROUP> --name <YOUR-FUNCTION-APP> --key-name USER_NAME --key-type functionKeys
List all keys:
az functionapp keys list --resource-group <YOUR-RESOURCE-GROUP> --name <YOUR-FUNCTION-APP>
Delete a key:
az functionapp keys delete --resource-group <YOUR-RESOURCE-GROUP> --name <YOUR-FUNCTION-APP> --key-name USER_NAME --key-type functionKeys