@@ -26,10 +26,6 @@ SwiftMCP follows Swift's standard documentation comment syntax, which uses Markd
2626 ``` swift
2727 - Returns: Description of return value
2828 ```
29- - Throws documentation for error cases:
30- ``` swift
31- - Throws: Description of error conditions
32- ```
3329
3430You can also use other documentation extensions like:
3531- ` - Note: `
@@ -90,35 +86,32 @@ The macro extracts:
9086- The method's main comment as the tool description
9187- Parameter documentation for each argument
9288- Return value documentation
93- - Any throws documentation if present
9489
9590## Custom Descriptions
9691
97- You can customize descriptions using the macro parameters :
92+ You can override a tool's description using the ` description ` parameter of the ` @MCPTool ` macro :
9893
9994``` swift
100- @MCPTool (description: " Custom tool description" )
95+ /// This description will be overridden
96+ @MCPTool (description: " Custom description for the tool" )
10197func customTool () { }
102-
103- @MCPTool (parameterDescriptions: [
104- " x" : " Custom description for parameter x"
105- ])
106- func paramTool (x : Int ) { }
10798```
10899
100+ The custom description will take precedence over any documentation comments.
101+
109102## Importance for AI Integration
110103
111104Documentation comments are crucial because:
1121051 . They provide context to AI assistants about your server's purpose
1131062 . They explain what each tool does and how to use it
1141073 . They describe what parameters mean and what values are expected
115- 4 . They help AIs understand error conditions and return values
108+ 4 . They help AIs understand return values
116109
117110Without proper documentation:
118111- AIs won't understand your server's purpose
119112- Tools may be used incorrectly
120113- Parameters may receive invalid values
121- - Error conditions may be handled improperly
114+ - Return values may be misinterpreted
122115
123116## Best Practices
124117
@@ -131,7 +124,6 @@ Without proper documentation:
131124 - Clear description of functionality
132125 - Parameter descriptions
133126 - Return value explanation
134- - Error conditions if applicable
135127
1361283 . Use markdown formatting in comments for better readability
137129
0 commit comments