-
Couldn't load subscription status.
- Fork 463
Adding MCP Tool Trigger Template #4651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
We will refrain from merging this PR until extension bundle gets released. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@swapnil-nagar can you please investigate the linux test failures |
That was the flaky test rebase fixed the issue |
34f1fdb to
dd978e2
Compare
| "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});" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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});" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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.
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
release_notes.mdAdditional information
Additional PR information