Skip to content

Commit

Permalink
🔥 remove non-standard endpoint event from SSE server
Browse files Browse the repository at this point in the history
  • Loading branch information
wesen committed Jan 21, 2025
1 parent cdbfab8 commit bf25c10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
6 changes: 3 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Tool API

- [ ] Add context to the tool call
- [ ] Don't allow a tool to be registered without interface
- [ ] Make tool an interface?
- [x] Add context to the tool call
- [x] Don't allow a tool to be registered without interface
- [x] Make tool an interface?

## MCP client

Expand Down
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,10 @@ Made Tool an interface with accessors and context-aware Call method for better e
Added support for all MCP protocol methods in the SSE server implementation:
- Updated SSEServer to use all services (prompt, resource, tool, initialize)
- Added handlers for all protocol methods (prompts/list, prompts/get, resources/list, resources/read, tools/list, tools/call)
- Improved error handling and response formatting
- Improved error handling and response formatting

# SSE Protocol Compliance

Removed non-standard endpoint event from SSE server to better align with the official protocol specification.

- Removed endpoint event from SSE server implementation
18 changes: 0 additions & 18 deletions pkg/server/sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,6 @@ func (s *SSEServer) handleSSE(w http.ResponseWriter, r *http.Request) {
s.mu.Unlock()
}()

// Send initial endpoint event
endpointData, err := s.marshalJSON(map[string]string{
"endpoint": fmt.Sprintf("/messages?session_id=%s", sessionID),
})
if err != nil {
s.logger.Error().Err(err).Msg("Failed to marshal endpoint data")
http.Error(w, "Internal server error", http.StatusInternalServerError)
return
}

endpointMsg := fmt.Sprintf("data: %s\n\n", endpointData)
s.logger.Debug().
Str("session_id", sessionID).
Str("endpoint", fmt.Sprintf("/messages?session_id=%s", sessionID)).
Msg("Sending endpoint information")
fmt.Fprint(w, endpointMsg)
w.(http.Flusher).Flush()

// Keep connection open and send messages
for {
select {
Expand Down

0 comments on commit bf25c10

Please sign in to comment.