From 2d44ec87445ff5a6c4cb7353716878ca95f7d496 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 5 Nov 2026 14:51:59 +0330 Subject: [PATCH] Adding Requirements for AiMcpServer Definition and Usage ... --- Attributes/XAiMcpToolAttribute.cs | 28 +++++++++++++++++++ Attributes/XAiMcpToolParamAttribute.cs | 34 +++++++++++++++++++++++ Attributes/XAiMcpToolTypeAttribute.cs | 10 +++++++ Controllers/XAiMcpServerControllerBase.cs | 33 ---------------------- 4 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 Attributes/XAiMcpToolAttribute.cs create mode 100644 Attributes/XAiMcpToolParamAttribute.cs create mode 100644 Attributes/XAiMcpToolTypeAttribute.cs delete mode 100644 Controllers/XAiMcpServerControllerBase.cs diff --git a/Attributes/XAiMcpToolAttribute.cs b/Attributes/XAiMcpToolAttribute.cs new file mode 100644 index 0000000..7fa9ed8 --- /dev/null +++ b/Attributes/XAiMcpToolAttribute.cs @@ -0,0 +1,28 @@ +using System; + +namespace xAiModels.Attributes +{ + /// + /// Decorate and Describe Specified MCP Tool to LLM ... + /// + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] + public class XAiMcpToolAttribute : Attribute + { + /// + /// Tools Unique Name (Default: Method Name) ... + /// + /// + public string Name { get; } + + /// + /// Tools Description for LLM ... + /// + /// + public string Description { get; set; } + + public XAiMcpToolAttribute(string name = null) + { + Name = name; + } + } +} \ No newline at end of file diff --git a/Attributes/XAiMcpToolParamAttribute.cs b/Attributes/XAiMcpToolParamAttribute.cs new file mode 100644 index 0000000..7630a19 --- /dev/null +++ b/Attributes/XAiMcpToolParamAttribute.cs @@ -0,0 +1,34 @@ +using System; + +namespace xAiModels.Attributes +{ + /// + /// Describe Specific Tools Parameter Metadata ... + /// + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] + public sealed class XAiMcpToolParamAttribute : Attribute + { + /// + /// Parameter Name in JSON (Default Parameter Name) ... + /// + /// + public string Name { get; } + + /// + /// Describe Parameter to LLM ... + /// + /// + public string Description { get; set; } + + /// + /// Specified this Parameter is Required or not (Default is true) ... + /// + /// + public bool Required { get; set; } = true; + + public XAiMcpToolParamAttribute(string name = null) + { + Name = name; + } + } +} \ No newline at end of file diff --git a/Attributes/XAiMcpToolTypeAttribute.cs b/Attributes/XAiMcpToolTypeAttribute.cs new file mode 100644 index 0000000..ef52bc6 --- /dev/null +++ b/Attributes/XAiMcpToolTypeAttribute.cs @@ -0,0 +1,10 @@ +using System; + +namespace xAiModels.Attributes +{ + /// + /// Decorate Tools Classes ... + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public class XAiMcpToolTypeAttribute : Attribute { } +} \ No newline at end of file diff --git a/Controllers/XAiMcpServerControllerBase.cs b/Controllers/XAiMcpServerControllerBase.cs deleted file mode 100644 index 71b225a..0000000 --- a/Controllers/XAiMcpServerControllerBase.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Linq; -using xCommons.Providers; -using xAiModels.Models.Dtos; -using xDataService.Interfaces; -using xCommons.Configurations; -using xDataService.Controllers; -using xAiModels.Models.Entities; -using Microsoft.Extensions.Logging; -using Microsoft.EntityFrameworkCore.Query; - -namespace xAiModels.Controllers -{ - public abstract class XAiMcpServerControllerBase : XBaseServiceController - { - protected XAiMcpServerControllerBase( - ILogger logger, - XAppConfiguration appConfiguration, - XValidationProvider validationProvider, - IXBaseRepositoryService repositoryService, - Func, IOrderedQueryable> defaultOrderBuilder = null, - Func, IIncludableQueryable> defaultIncludeBuilder = null - ) : base( - logger, - appConfiguration, - validationProvider, - repositoryService, - defaultOrderBuilder, - defaultIncludeBuilder - ) - { } - } -} \ No newline at end of file