File tree Expand file tree Collapse file tree
src/Dibix.Sdk.CodeGeneration/Validation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ private bool ValidateAmbiguousActionNames(IEnumerable<ActionRegistration> action
128128
129129 private bool ValidateAction ( ActionDefinition action )
130130 {
131- bool isValid = ValidateReservedPathSegments ( action ) && ValidateParameters ( action ) && ValidateBodyAllowedForMethod ( action ) ;
131+ bool isValid = ValidateReservedPathSegments ( action ) && ValidateParameters ( action ) && ValidateBodyAllowedForMethod ( action ) && ValidateMcpDescription ( action ) ;
132132 return isValid ;
133133 }
134134
@@ -194,6 +194,19 @@ private bool ValidateBodyAllowedForMethod(ActionDefinition action)
194194 return isValid ;
195195 }
196196
197+ // [warning] Tool GetTemplateDefinition does not have a description. Tools must be accurately described to be called
198+ private bool ValidateMcpDescription ( ActionDefinition actionDefinition )
199+ {
200+ if ( actionDefinition . ModelContextProtocolType == ModelContextProtocolType . None )
201+ return true ;
202+
203+ if ( actionDefinition . Description != null )
204+ return true ;
205+
206+ _logger . LogError ( $ "A description for action '{ actionDefinition . OperationId } ' must be provided, when being exposed via MCP", actionDefinition . Location ) ;
207+ return false ;
208+ }
209+
197210 // When using the BODY.$RAW property source, the raw body will be passed to as a stream to an SqlParameter.
198211 // The stream will be only accessed asynchronously if one of the async ADO.NET methods is used.
199212 // Otherwise, it will cause this exception in the ASP.NET core host:
You can’t perform that action at this time.
0 commit comments