Skip to content

Commit f135355

Browse files
authored
Propagate fix from AIFunctionFactory to TemporaryAIFunctionFactory (#215)
1 parent 5e606c1 commit f135355

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ModelContextProtocol/Server/TemporaryAIFunctionFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,7 @@ static bool IsAsyncMethod(MethodInfo method)
568568
throw new ArgumentException("Parameter is missing a name.", nameof(parameter));
569569
}
570570

571-
// Resolve the contract used to marshal the value from JSON -- can throw if not supported or not found.
572571
Type parameterType = parameter.ParameterType;
573-
JsonTypeInfo typeInfo = serializerOptions.GetTypeInfo(parameterType);
574572

575573
// For CancellationToken parameters, we always bind to the token passed directly to InvokeAsync.
576574
if (parameterType == typeof(CancellationToken))
@@ -606,6 +604,8 @@ static bool IsAsyncMethod(MethodInfo method)
606604
}
607605

608606
// For all other parameters, create a marshaller that tries to extract the value from the arguments dictionary.
607+
// Resolve the contract used to marshal the value from JSON -- can throw if not supported or not found.
608+
JsonTypeInfo typeInfo = serializerOptions.GetTypeInfo(parameterType);
609609
return (arguments, _) =>
610610
{
611611
// If the parameter has an argument specified in the dictionary, return that argument.

0 commit comments

Comments
 (0)