Skip to content

reflect: Elem of invalid type mcp.Result #375

@zhaohuabing

Description

@zhaohuabing

Describe the bug

Call

ClientSession.Complete(m.T().Context(), &mcp.CompleteParams{
		Argument: mcp.CompleteParamsArgument{
			Name:  "language",
			Value: "py",
		},
		Ref: &mcp.CompleteReference{
			Type: "ref/prompt",
			Name: "code_review",
		},
	})

Got this error

     reflect: Elem of invalid type mcp.Result
            goroutine 114 [running]:
            runtime/debug.Stack()
            	/home/linuxbrew/.linuxbrew/Cellar/go/1.25.0/libexec/src/runtime/debug/stack.go:26 +0x5e
            github.com/stretchr/testify/suite.failOnPanic(0xc000702380, {0x131bfa0, 0xc00071a620})
            	/home/ubuntu/go/pkg/mod/github.com/stretchr/[email protected]/suite/suite.go:89 +0x37
            github.com/stretchr/testify/suite.Run.func1.1()
            	/home/ubuntu/go/pkg/mod/github.com/stretchr/[email protected]/suite/suite.go:184 +0x25f
            panic({0x131bfa0?, 0xc00071a620?})
            	/home/linuxbrew/.linuxbrew/Cellar/go/1.25.0/libexec/src/runtime/panic.go:783 +0x132
            reflect.elem(0x1?)
            	/home/linuxbrew/.linuxbrew/Cellar/go/1.25.0/libexec/src/reflect/type.go:742 +0x9a
            reflect.(*rtype).Elem(0xc0003691d8?)
            	/home/linuxbrew/.linuxbrew/Cellar/go/1.25.0/libexec/src/reflect/type.go:746 +0x15
            github.com/modelcontextprotocol/go-sdk/mcp.newServerMethodInfo[...].func4()
            	/home/ubuntu/mcp-go-sdk/mcp/shared.go:296 +0x2e
            github.com/modelcontextprotocol/go-sdk/mcp.defaultSendingMethodHandler[...]({0x18550d0?, 0xc000618000}, {0x16497f3, 0x13}, {0x1855990, 0xc000518390})
            	/home/ubuntu/mcp-go-sdk/mcp/shared.go:101 +0x1c2
            github.com/modelcontextprotocol/go-sdk/mcp.handleSend[...]({0x18550d0, 0xc000618000}, {0x16497f3, 0x13}, {0x1855990, 0xc000518390})
            	/home/ubuntu/mcp-go-sdk/mcp/shared.go:126 +0x71
            github.com/modelcontextprotocol/go-sdk/mcp.(*ClientSession).Complete(0xc00033c1c0, {0x18550d0, 0xc000618000}, 0xc0007126c0?)
            	/home/ubuntu/mcp-go-sdk/mcp/client.go:601 +0xcc

To Reproduce
Steps to reproduce the behavior:

  1. call ClientSession.Complete

Expected behavior
I should be able to call ClientSession.Complete

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions