You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
765 B
C#
31 lines
765 B
C#
namespace McpStudy.McpServerSSE.Tools
|
|
{
|
|
[McpServerToolType]
|
|
public class StringTools
|
|
{
|
|
[McpServerTool,DisplayName("GetTextLength"), Description("获取文本的长度")]
|
|
public static int GetTextLength(string text)
|
|
{
|
|
if (text == null)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
return text.Length;
|
|
}
|
|
|
|
[McpServerTool, DisplayName("ReverseText"), Description("反转文本内容:把给定文本反序")]
|
|
public static string ReverseText(string text)
|
|
{
|
|
if (text == null)
|
|
{
|
|
return "";
|
|
}
|
|
else
|
|
{
|
|
return string.Join("", text.Reverse());
|
|
}
|
|
}
|
|
}
|
|
}
|