Closed
Description
The example in the README does not work, specifically the prompt registering. It seems something related to serialization on the function:
server.go
func (c promptResponseSent) MarshalJSON() ([]byte, error) {
if c.Error != nil {
errorText := c.Error.Error()
c.Response = NewPromptResponse("error", NewPromptMessage(NewTextContent(errorText), RoleUser))
}
return json.Marshal(c)
}
Stacktrace:
runtime: goroutine stack exceeds 1000000000-byte limit runtime: sp=0x14020260360 stack=[0x14020260000, 0x14040260000] fatal error: stack overflow
runtime stack:
runtime.throw({0x1025f39c7?, 0xffffffffffffffff?}) /opt/homebrew/opt/go/libexec/src/runtime/panic.go:1067 +0x38 fp=0x16e12ed90 sp=0x16e12ed60 pc=0x1023c7618 runtime.newstack() /opt/homebrew/opt/go/libexec/src/runtime/stack.go:1117 +0x460 fp=0x16e12eed0 sp=0x16e12ed90 pc=0x1023ac490 runtime.morestack()
/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:342 +0x70 fp=0x16e12eed0 sp=0x16e12eed0 pc=0x1023cd630 goroutine 40 gp=0x14000187500 m=12 mp=0x14000a80008 [running]: runtime.deductAssistCredit(0x18?) /opt/homebrew/opt/go/libexec/src/runtime/malloc.go:1333 +0x7c fp=0x14020260360 sp=0x14020260360 pc=0x10236813c runtime.mallocgc(0x18, 0x1026dac60, 0x1) /opt/homebrew/opt/go/libexec/src/runtime/malloc.go:1037 +0xe8 fp=0x14020260400 sp=0x14020260360 pc=0x1023c2128
runtime.convT(0x1026dac60, 0x14020260498) /opt/homebrew/opt/go/libexec/src/runtime/iface.go:344 +0x38 fp=0x14020260430 sp=0x14020260400 pc=0x102365c28 github.com/metoro-io/mcp-golang.promptResponseSent.MarshalJSON({0x140000100a0, {0x0, 0x0}}) /Users/claudemiro/go/pkg/mod/github.com/metoro-io/mcp-golang@v0.3.0/server.go:97 +0x1c0 fp=0x14020260490 sp=0x14020260430 pc=0x1025e6240 github.com/metoro-io/mcp-golang.(*promptResponseSent).MarshalJSON(0x1026dac60?) <autogenerated>:1 +0x38 fp=0x140202604c0 sp=0x14020260490 pc=0x1025eb2c8
encoding/json.marshalerEncoder(0x14005195900, {0x1026dac60?, 0x1400518dd10?, 0x10270b740?}, {0x60?, 0xac?}) /opt/homebrew/opt/go/libexec/src/encoding/json/encode.go:441 +0xc0 fp=0x14020260580 sp=0x140202604c0 pc=0x10243f220 encoding/json.condAddrEncoder.encode({0x1027135d0?, 0x102713618?}, 0x14020260608?, {0x1026dac60?, 0x1400518dd10?, 0x1026dac60?}, {0x98?, 0x71?}) /opt/homebrew/opt/go/libexec/src/encoding/json/encode.go:904 +0x78 fp=0x140202605c0 sp=0x14020260580 pc=0x102442978 encoding/json.condAddrEncoder.encode-fm(0x1026dac60?, {0x1026dac60?, 0x1400518dd10?, 0x40?}, {0xa0?, 0x3a?}) <autogenerated>:1 +0x54 fp=0x14020260610 sp=0x140202605c0 pc=0x102452114 encoding/json.(*encodeState).reflectValue(0x14005195900, {0x1026dac60?, 0x1400518dd10?, 0x10243e558?}, {0x38?, 0x0?}) /opt/homebrew/opt/go/libexec/src/encoding/json/encode.go:322 +0x70 fp=0x14020260670 sp=0x14020260610 pc=0x10243e8d0 encoding/json.(*encodeState).marshal(0x0?, {0x1026dac60?, 0x1400518dd10?}, {0x0?, 0x0?}) /opt/homebrew/opt/go/libexec/src/encoding/json/encode.go:298 +0xb8 fp=0x140202606f0 sp=0x14020260670 pc=0x10243e678 encoding/json.Marshal({0x1026dac60, 0x1400518dd10}) /opt/homebrew/opt/go/libexec/src/encoding/json/encode.go:164 +0x8c fp=0x140202607b0 sp=0x140202606f0 pc=0x10243dfdc github.com/metoro-io/mcp-golang.promptResponseSent.MarshalJSON({0x140000100a0, {0x0, 0x0}}) /Users/claudemiro/go/pkg/mod/github.com/metoro-io/mcp-golang@v0.3.0/server.go:97 +0x1d0 fp=0x14020260810 sp=0x140202607b0 pc=0x1025e6250 github.com/metoro-io/mcp-golang.(*promptResponseSent).MarshalJSON(0x1026dac60?) <autogenerated>:
I spent some time trying to debug using the inspector (https://modelcontextprotocol.io/docs/tools/inspector), but without being able to add break points in the code the debugging is challenging.
Perhaps I could setup a go workspace to go deeper, anyway, in the meantime I am reporting the issue, just in case you have time to debug it.
Thanks for the library :)
Metadata
Metadata
Assignees
Labels
No labels