checkInitialized returns a formatted error if the server has not yet received the initialized notification.
(method string)
| 1143 | // checkInitialized returns a formatted error if the server has not yet |
| 1144 | // received the initialized notification. |
| 1145 | func (ss *ServerSession) checkInitialized(method string) error { |
| 1146 | if !ss.hasInitialized() { |
| 1147 | // TODO(rfindley): enable this check. |
| 1148 | // Right now is is flaky, because server tests don't await the initialized notification. |
| 1149 | // Perhaps requests should simply block until they have received the initialized notification |
| 1150 | |
| 1151 | // if strings.HasPrefix(method, "notifications/") { |
| 1152 | // return fmt.Errorf("must not send %q before %q is received", method, notificationInitialized) |
| 1153 | // } else { |
| 1154 | // return fmt.Errorf("cannot call %q before %q is received", method, notificationInitialized) |
| 1155 | // } |
| 1156 | } |
| 1157 | return nil |
| 1158 | } |
| 1159 | |
| 1160 | func (ss *ServerSession) ID() string { |
| 1161 | if c, ok := ss.mcpConn.(hasSessionID); ok { |
no test coverage detected