Skip to content

Commit dd7dcc5

Browse files
committed
Fix spelling
1 parent 138c1c3 commit dd7dcc5

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

server/hooks.go

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/internal/gen/hooks.go.tmpl

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type OnSuccessHookFunc func(ctx context.Context, id any, method mcp.MCPMethod, m
3838
// }
3939
//
4040
// // Use errors.As to get specific error types
41-
// var parseErr = &UnparseableMessageError{}
41+
// var parseErr = &UnparsableMessageError{}
4242
// if errors.As(err, &parseErr) {
4343
// // Access specific methods/fields of the error type
4444
// log.Printf("Failed to parse message for method %s: %v",
@@ -104,9 +104,9 @@ func (c *Hooks) AddOnSuccess(hook OnSuccessHookFunc) {
104104
// }
105105
//
106106
// // For parsing errors
107-
// var parseErr = &UnparseableMessageError{}
107+
// var parseErr = &UnparsableMessageError{}
108108
// if errors.As(err, &parseErr) {
109-
// // Handle unparseable message errors
109+
// // Handle unparsable message errors
110110
// fmt.Printf("Failed to parse %s request: %v\n",
111111
// parseErr.GetMethod(), parseErr.Unwrap())
112112
// errChan <- parseErr
@@ -160,7 +160,7 @@ func (c *Hooks) onSuccess(ctx context.Context, id any, method mcp.MCPMethod, mes
160160
//
161161
// Common error types include:
162162
// - ErrUnsupported: When a capability is not enabled
163-
// - UnparseableMessageError: When request parsing fails
163+
// - UnparsableMessageError: When request parsing fails
164164
// - ErrResourceNotFound: When a resource is not found
165165
// - ErrPromptNotFound: When a prompt is not found
166166
// - ErrToolNotFound: When a tool is not found

server/internal/gen/request_handler.go.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (s *MCPServer) HandleMessage(
7878
err = &requestError{
7979
id: baseMessage.ID,
8080
code: mcp.INVALID_REQUEST,
81-
err: &UnparseableMessageError{message: message, err: unmarshalErr, method: baseMessage.Method},
81+
err: &UnparsableMessageError{message: message, err: unmarshalErr, method: baseMessage.Method},
8282
}
8383
} else {
8484
s.hooks.before{{.HookName}}(ctx, baseMessage.ID, &request)

server/request_handler.go

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/server.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,27 @@ func ClientSessionFromContext(ctx context.Context) ClientSession {
7373
return nil
7474
}
7575

76-
// UnparseableMessageError is attached to the RequestError when json.Unmarshal
76+
// UnparsableMessageError is attached to the RequestError when json.Unmarshal
7777
// fails on the request.
78-
type UnparseableMessageError struct {
78+
type UnparsableMessageError struct {
7979
message json.RawMessage
8080
method mcp.MCPMethod
8181
err error
8282
}
8383

84-
func (e *UnparseableMessageError) Error() string {
85-
return fmt.Sprintf("unparseable %s request: %s", e.method, e.err)
84+
func (e *UnparsableMessageError) Error() string {
85+
return fmt.Sprintf("unparsable %s request: %s", e.method, e.err)
8686
}
8787

88-
func (e *UnparseableMessageError) Unwrap() error {
88+
func (e *UnparsableMessageError) Unwrap() error {
8989
return e.err
9090
}
9191

92-
func (e *UnparseableMessageError) GetMessage() json.RawMessage {
92+
func (e *UnparsableMessageError) GetMessage() json.RawMessage {
9393
return e.message
9494
}
9595

96-
func (e *UnparseableMessageError) GetMethod() mcp.MCPMethod {
96+
func (e *UnparsableMessageError) GetMethod() mcp.MCPMethod {
9797
return e.method
9898
}
9999

server/server_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -793,11 +793,11 @@ func TestMCPServer_HandleInvalidMessages(t *testing.T) {
793793
message: `{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": "invalid"}`,
794794
expectedErr: mcp.INVALID_REQUEST,
795795
validateErr: func(t *testing.T, err error) {
796-
unparseableErr := &UnparseableMessageError{}
797-
ok := errors.As(err, &unparseableErr)
798-
assert.True(t, ok, "Error should be UnparseableMessageError")
799-
assert.Equal(t, mcp.MethodInitialize, unparseableErr.GetMethod())
800-
assert.Equal(t, json.RawMessage(`{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": "invalid"}`), unparseableErr.GetMessage())
796+
unparsableErr := &UnparsableMessageError{}
797+
ok := errors.As(err, &unparsableErr)
798+
assert.True(t, ok, "Error should be UnparsableMessageError")
799+
assert.Equal(t, mcp.MethodInitialize, unparsableErr.GetMethod())
800+
assert.Equal(t, json.RawMessage(`{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": "invalid"}`), unparsableErr.GetMessage())
801801
},
802802
},
803803
{

0 commit comments

Comments
 (0)