+ * This is a declarative annotation placed on the same parameter as the trigger + * annotation ({@link McpToolTrigger} or {@link McpResourceTrigger}). The metadata is surfaced + * in the MCP protocol's {@code _meta} field when clients call {@code tools/list} or + * {@code resources/list}. + *
+ *+ * The {@code json} property must contain valid JSON. It can include any arbitrary key-value + * pairs such as author information, version numbers, UI hints, tags, or nested objects. + *
+ * + *Example with a resource trigger:
+ *
+ * {@literal @}FunctionName("getReadme")
+ * public String getReadme(
+ * {@literal @}McpResourceTrigger(
+ * name = "context",
+ * uri = "file://readme.md",
+ * resourceName = "readme",
+ * description = "Application readme file",
+ * mimeType = "text/plain"
+ * )
+ * {@literal @}McpMetadata(
+ * name = "context",
+ * json = "{\"author\": \"John Doe\", \"version\": 1.0}"
+ * ) String context,
+ * final ExecutionContext executionContext
+ * ) {
+ * return "# My Application";
+ * }
+ *
+ *
+ * Example with a tool trigger:
+ *
+ * {@literal @}FunctionName("getWeather")
+ * public String getWeather(
+ * {@literal @}McpToolTrigger(
+ * name = "context",
+ * description = "Returns weather information"
+ * )
+ * {@literal @}McpMetadata(
+ * name = "context",
+ * json = "{\"version\": 1.0, \"author\": \"Jane Doe\"}"
+ * ) String context
+ * ) {
+ * return "Sunny, 72°F";
+ * }
+ *
+ *
+ * @see McpToolTrigger
+ * @see McpResourceTrigger
+ * @since 3.2.4
+ */
+@Target({ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface McpMetadata {
+
+ /**
+ * The binding parameter name. Should match the {@code name()} of the trigger
+ * annotation on the same parameter.
+ *
+ * @return The parameter binding name
+ */
+ String name();
+
+ /**
+ * Defines how Functions runtime should treat the parameter value. Possible values are:
+ * + * Must contain valid JSON. The contents are surfaced in the MCP protocol's + * {@code _meta} field when clients discover available tools or resources. + *
+ * + *Example:
+ *
+ * json = "{\"author\": \"John Doe\", \"version\": 1.0, \"tags\": [\"utility\", \"time\"]}"
+ *
+ *
+ * @return The metadata JSON string
+ */
+ String json();
+}
diff --git a/src/main/java/com/microsoft/azure/functions/annotation/McpResourceTrigger.java b/src/main/java/com/microsoft/azure/functions/annotation/McpResourceTrigger.java
new file mode 100644
index 0000000..9142f38
--- /dev/null
+++ b/src/main/java/com/microsoft/azure/functions/annotation/McpResourceTrigger.java
@@ -0,0 +1,108 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+
+package com.microsoft.azure.functions.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Triggers an Azure Function when an MCP client requests to read a resource.
+ * + * This annotation enables Azure Functions to expose content (files, data, images) + * as MCP resources that can be discovered and consumed by MCP-compatible clients + * like AI assistants. The function returns the resource content as a string (text) + * or byte[] (binary). + *
+ * + *Example (text resource):
+ *
+ * {@literal @}FunctionName("getReadme")
+ * public String getReadme(
+ * {@literal @}McpResourceTrigger(
+ * name = "context",
+ * uri = "file://readme.md",
+ * resourceName = "readme",
+ * description = "Application readme file",
+ * mimeType = "text/plain"
+ * ) String context,
+ * final ExecutionContext executionContext
+ * ) {
+ * return "# My Application\nThis is the readme content.";
+ * }
+ *
+ *
+ * @see McpToolTrigger
+ * @since 3.2.4
+ */
+@Target({ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface McpResourceTrigger {
+
+ /**
+ * The binding name for the resource invocation context parameter.
+ *
+ * @return The parameter binding name
+ */
+ String name();
+
+ /**
+ * Defines how Functions runtime should treat the parameter value. Possible values are:
+ *