test(mcp): 13 PM tool tests + fix jsonschema tags

Add tools_pm_test.go with 13 integration tests covering all 16 PM
tools via SDK in-memory transport with fake services.

Fix jsonschema tags in tools_pm.go and tools_chat.go — SDK's tag
parser rejects "required,min=1" and "required,description=X" syntax;
use plain description text instead (non-pointer fields are auto-required).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-08 11:52:24 +08:00
parent 7d9164d478
commit 62d9a91ca5
3 changed files with 604 additions and 27 deletions
+3 -3
View File
@@ -15,9 +15,9 @@ func registerChatTools(srv *mcpsdk.Server, deps ServerDeps) {
}
type listRecentMessagesIn struct {
ConversationID string `json:"conversation_id" jsonschema:"required,description=UUID of the conversation"`
BeforeID *int64 `json:"before_id,omitempty" jsonschema:"description=Cursor: return messages with ID < this value"`
Limit int `json:"limit,omitempty" jsonschema:"description=Max messages to return (default 50, max 200)"`
ConversationID string `json:"conversation_id" jsonschema:"UUID of the conversation"`
BeforeID *int64 `json:"before_id,omitempty" jsonschema:"cursor: return messages with ID < this value"`
Limit int `json:"limit,omitempty" jsonschema:"max messages to return (default 50, max 200)"`
}
type messageSummary struct {
ID int64 `json:"id"`