Skip to content

Commit c2cfd5f

Browse files
authored
Update MCPServer.cs
1 parent 5f04662 commit c2cfd5f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

MCPSharp/Core/MCPServer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ public static async Task StartAsync(string serverName, string version)
100100
.Where(t =>
101101
{
102102
bool classHasToolAttribute = t.GetCustomAttribute<McpToolAttribute>() != null;
103-
bool methodHasToolAttribute = t.GetMethods().Any(m => m.GetCustomAttribute<McpFunctionAttribute>() != null);
103+
bool methodHasToolAttribute = t.GetMethods().Any(m => m.GetCustomAttribute<McpToolAttribute>() != null);
104+
bool methodHasFunctionAttribute = t.GetMethods().Any(m => m.GetCustomAttribute<McpFunctionAttribute>() != null);
104105
bool methodHasResourceAttribute = t.GetMethods().Any(m => m.GetCustomAttribute<McpResourceAttribute>() != null);
105106

106-
return classHasToolAttribute || methodHasToolAttribute || methodHasResourceAttribute;
107+
return classHasToolAttribute || methodHasToolAttribute || methodHasFunctionAttribute || methodHasResourceAttribute;
107108
});
108109

109110
foreach (var toolType in allTypes)
@@ -147,4 +148,4 @@ internal void Dispose()
147148
_rpc.Dispose();
148149
}
149150
}
150-
}
151+
}

0 commit comments

Comments
 (0)