Skip to content

Conversation

@swapnil-nagar
Copy link

MCP tool trigger Template for GA release

Issue describing the changes in this PR

Adding the typescript and javascript mcpToolTrigger.

resolves #issue_for_this_pr

Pull request checklist

  • [] My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Additional PR information

Copy link
Member

@soninaren soninaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding would put a customer's function app in a broken state with no clue how to fix it. The only way it would work is if customers know to include preview extension bundle. Which does not include mcp extension at the moment.

My recommendation here would be to wait until mcp extension is included in the GA bundle or is atleast part of the preview bundle and then add instructions as code comments in the .js file.

@swapnil-nagar swapnil-nagar marked this pull request as ready for review October 14, 2025 22:22
@swapnil-nagar swapnil-nagar requested a review from a team as a code owner October 14, 2025 22:22
@swapnil-nagar
Copy link
Author

Adding would put a customer's function app in a broken state with no clue how to fix it. The only way it would work is if customers know to include preview extension bundle. Which does not include mcp extension at the moment.

My recommendation here would be to wait until mcp extension is included in the GA bundle or is atleast part of the preview bundle and then add instructions as code comments in the .js file.

We will refrain from merging this PR until extension bundle gets released.

@liliankasem
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liliankasem
Copy link
Member

@swapnil-nagar can you please investigate the linux test failures

@swapnil-nagar swapnil-nagar requested a review from a team as a code owner October 21, 2025 21:10
@swapnil-nagar
Copy link
Author

@swapnil-nagar can you please investigate the linux test failures

That was the flaky test rebase fixed the issue

@swapnil-nagar swapnil-nagar force-pushed the swapnil/McpToolTriggerTemplate branch from 34f1fdb to dd978e2 Compare October 22, 2025 00:02
"id": "McpToolTrigger-Javascript-4.x",
"runtime": "2",
"files": {
"%functionName%.js": "import { app } from \"@azure/functions\";\n\nconst PROPERTY_TYPE = \"string\";\n\n// Hello function - responds with hello message\nexport async function mcpToolHello(_toolArguments, context) {\n // Get name from the tool arguments\n const mcptoolargs = context.triggerMetadata.mcptoolargs || {};\n const name = mcptoolargs.name;\n\n console.info(`Hello ${name}, I am MCP Tool!`);\n\n return `Hello ${name}, I am MCP Tool!`;\n}\n\n// Register the hello tool\napp.mcpTool('hello', {\n toolName: 'hello',\n description: 'Simple hello world MCP Tool that responses with a hello message.',\n toolProperties: [\n {\n propertyName: \"name\",\n propertyType: PROPERTY_TYPE,\n description: \"Required property to identify the caller.\",\n isRequired: true,\n }\n ],\n handler: mcpToolHello\n});"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got an error with this template:

[2025-10-24T00:10:38.392Z] Worker was unable to load entry point "src/functions/mcpToolTrigger.js": Cannot use import statement outside a module
[2025-10-24T00:10:38.786Z] /Users/likasem/source/functions/azure-functions-core-tools/_testapp/src/functions/mcpToolTrigger.js:1
[2025-10-24T00:10:38.786Z] import { app } from "@azure/functions";
[2025-10-24T00:10:38.786Z] ^^^^^^
[2025-10-24T00:10:38.786Z] SyntaxError: Cannot use import statement outside a module

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried with the steps and those steps worked for me. Lets connect offline to resolve this.

dotnet run --project src/Cli/func -- init --script-root ./_testapp
Node
Javascript

dotnet run --project src/Cli/func -- new --script-root ./_testapp
Mcp Tool Trigger

// cd into ./_testapp

npm i
func start

"id": "McpToolTrigger-Typescript-4.x",
"runtime": "2",
"files": {
"%functionName%.ts": "import { app, InvocationContext, output } from \"@azure/functions\";\n\nconst PROPERTY_TYPE = \"string\";\n\n// Hello function - responds with hello message\nexport async function mcpToolHello(_toolArguments:unknown, context: InvocationContext): Promise<string> {\n // Get name from the tool arguments\n const mcptoolargs = context.triggerMetadata.mcptoolargs as {\n name?: string;\n };\n const name = mcptoolargs?.name;\n\n console.info(`Hello ${name}, I am MCP Tool!`);\n\n return `Hello ${name}, I am MCP Tool!`;\n}\n\n// Register the hello tool\napp.mcpTool('hello', {\n toolName: 'hello',\n description: 'Simple hello world MCP Tool that responses with a hello message.',\n toolProperties:[\n {\n propertyName: \"name\",\n propertyType: PROPERTY_TYPE,\n description: \"Required property to identify the caller.\",\n isRequired: true,\n }],\n handler: mcpToolHello\n});"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Template seems to be OK, but it looks like we're still pulling the old ext bundle as it does not find the binding - is the new ext bundle with mcp fully released?

[2025-10-24T00:15:31.369Z] The 'hello' function is in error: The binding type(s) 'mcpToolTrigger' were not found in the configured extension bundle. Please ensure the type is correct and the correct version of extension bundle is configured.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, but it is in flight. We will have the bundle release early next week.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Naren that we should not merge until bundles is fully out. I can provide approval next week after validating with bundles releases

Copy link
Member

@soninaren soninaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, As per my previous recommendation lets wait until the bundle is fully released, specifically to cdn where core tools can download from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants