DEV Community

Daniel Jonathan
Daniel Jonathan

Posted on

LogicApp Autonomous Agents for Dynamic Tool Creation in LogicApp MCP Server

What if your MCP server could get new tools on-demand, without you writing a single line of workflow JSON?

That’s exactly what this autonomous agent does: it creates Logic App workflows dynamically, publishes them, and registers them as MCP tools.


🔧 The Idea

Instead of manually designing every Logic App, we let an Azure OpenAI agent generate workflows automatically.

  • You send a spec (like operator: add, parameters: "x number, y number").
  • The agent builds a valid workflow.json based on strict rules.
  • The workflow is deployed into your Logic App (via SCM/Kudu API).
  • Instantly, you get a new HTTP endpoint = a new MCP tool.

This means your MCP server can provision tools dynamically, as needed.


🗂️ The Autonomous Agent Workflow Overview

Here’s the Logic App workflow (wf_mcp_toolbuilder) in Designer view:

Image description0

🔧 Components in the Workflow

  1. CreateWorkflow (HTTP trigger)

    • Accepts a POST request with a spec (operator, parameters, return type, trigger name, description).
    • This is the entry point for provisioning a new tool.
  2. ** jsonPlaceHolder (Initialize variable)**

    • Prepares storage for the workflow JSON.
  3. AgentInstructions (Compose)

    • Provides strict system instructions for the Azure OpenAI agent.
    • Defines naming rules, schema parsing, allowed operators, and expression mappings.
  4. Agent (Azure OpenAI)

    • Takes the instructions and user payload.
    • Generates a complete workflow.json.
  5. WorkflowCreator (Tool)

    • Captures the agent’s JSON output.
    • Stores it in a variable (jsonworkflow) for publishing.
  6. PublishToScm (Tool)

    • Step 1: Create the workflow folder
      • Uses HTTP PUT to: https://<yourapp>.scm.azurewebsites.net/api/vfs/site/wwwroot/@{agentParameters('workflowname')}//
    • Step 2: Upload the workflow definition file
      • Uses HTTP PUT to: https://<yourapp>.scm.azurewebsites.net/api/vfs/site/wwwroot/@{agentParameters('workflowname')}/workflow.json
      • The body is the jsonworkflow variable.

Notes:

  • Basic Authentication is enabled for SCM publishing (Authorization header).
  • The folder name is injected via agentParameters('workflowname').
  • The workflow content is injected via the jsonworkflow variable.
  • Header If-Match: * ensures overwrite on redeploy.

Once these two PUT calls succeed, the workflow folder is created in /site/wwwroot/ and the workflow.json is uploaded, making the tool active.


✅ Test & Validate the Autonomous Agent

Once the autonomous agent workflow (wf_mcp_toolbuilder) is deployed, you should validate that it can take a request, generate JSON, and publish a new tool successfully.

1) Send a sample request

POST to the CreateWorkflow trigger with a payload:

curl -sS -X POST "<TOOLBUILDER_URL>" \
  -H "Content-Type: application/json" \
  -d '{
  "operator": "multiple",
  "parameters": "x number, y number",
  "return_type": "string",
}'
Enter fullscreen mode Exit fullscreen mode

🎉 Result

Seeing both WorkflowCreator and PublishToScm actions marked ✓ in Run History confirms that:

  • The agent generated valid workflow JSON.
  • The tool execution stage ran as expected.
  • The workflow was published successfully.

Together with the SCM folder check, this validates that the autonomous agent can generate, publish, and activate new MCP tools on demand.

Image description4


🔁 Other Workflows

I also created additional arithmetic workflows using the same autonomous agent process.

  1. In SCM, new workflow folders appeared under /site/wwwroot/, each containing its own workflow.json.

  2. Using Postman, the new tools were tested via HTTP POST requests and returned the expected results.

📸 The SCM folder view clearly shows the new workflows, and the Postman screenshots demonstrate the tools working end-to-end.

SCM-Console:

Image description1

Postman:

Image description2


⏭️ Next Steps

This demo showed how easily we can add tools to an MCP server.

While the example used arithmetic operations, the real power comes with real business use cases:

  • Exposing your database stored procedures as MCP tools.
  • Whenever a new proc is created, the wf_mcp_toolbuilder workflow can auto-generate and publish a new MCP tool on your Logic App MCP server.
  • The MCP client will then be able to discover and access these tools dynamically — without any manual setup.
  • You can trigger wf_mcp_toolbuilder either on a schedule (polling for new procs) or via a webhook (fire immediately when a new proc is registered).

This opens the door for dynamic, scalable, and real-time tool provisioning in your MCP ecosystem.

Top comments (0)