Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Cli/func/Common/TemplatesManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Reflection;
Expand Down Expand Up @@ -134,7 +134,7 @@ private static async Task<IEnumerable<Template>> GetNodeV4TemplatesJson()

public async Task Deploy(string name, string fileName, Template template)
{
if (template.Id.EndsWith("JavaScript-4.x") || template.Id.EndsWith("TypeScript-4.x"))
if (template.Id.EndsWith("JavaScript-4.x", StringComparison.OrdinalIgnoreCase) || template.Id.EndsWith("TypeScript-4.x", StringComparison.OrdinalIgnoreCase))
{
await DeployNewNodeProgrammingModel(name, fileName, template);
}
Expand Down
42 changes: 42 additions & 0 deletions src/Cli/func/StaticResources/node-v4-templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,5 +614,47 @@
"enabledInTryMode": false,
"userPrompt": []
}
},
{
"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

},
"metadata": {
"defaultFunctionName": "mcpToolTrigger",
"description": "$McpToolTrigger_description",
"name": "Mcp Tool Trigger",
"language": "TypeScript",
"triggerType": "mcpToolTrigger",
"category": [
"$temp_category_core",
"$temp_category_dataProcessing"
],
"categoryStyle": "other",
"enabledInTryMode": false,
"userPrompt": []
}
},
{
"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

},
"metadata": {
"defaultFunctionName": "mcpToolTrigger",
"description": "$McpToolTrigger_description",
"name": "Mcp Tool Trigger",
"language": "JavaScript",
"triggerType": "mcpToolTrigger",
"category": [
"$temp_category_core",
"$temp_category_dataProcessing"
],
"categoryStyle": "other",
"enabledInTryMode": false,
"userPrompt": []
}
}
]
Loading