Skip to content

MCP Server Initialization Failure: Enum Tag Validation Error in Tool Registration #3

@fakebizprez

Description

@fakebizprez

I’m trying to create a HTTP MCP server w/ the go SDK.

Please analyze these testing logs:

“host”:

fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 
➜   ./twenty-crm-mcp-server
2025/10/19 03:04:10 Starting Twenty CRM MCP HTTP Server on 0.0.0.0:8080
2025/10/19 03:04:10 MCP endpoint: http://0.0.0.0:8080/mcp
2025/10/19 03:04:22 http: panic serving [::1]:55176: AddTool: tool "create_task": input schema: ForType(tools.CreateTaskInput): tag must not begin with 'WORD=': "enum=TODO,enum=IN_PROGRESS,enum=DONE"
goroutine 38 [running]:
net/http.(*conn).serve.func1()
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:1943 +0xb4
panic({0x104763e40?, 0x140003da120?})
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/runtime/panic.go:783 +0x120
github.com/modelcontextprotocol/go-sdk/mcp.AddTool[...](0x140001ce180?, 0x1400003b908, 0x0)
        /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/server.go:400 +0xbc
github.com/linehaul/twenty-crm-mcp-http/internal/tools.RegisterTaskTools(0x140001ce180, 0x140001efd10)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/tools/tasks.go:32 +0xb0
github.com/linehaul/twenty-crm-mcp-http/internal/server.NewMCPServer(0x140001efd10)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/server/server.go:24 +0x8c
main.main.func1(0x14000258210?)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/cmd/server/main.go:45 +0x20
github.com/modelcontextprotocol/go-sdk/mcp.(*StreamableHTTPHandler).ServeHTTP(0x140001efda0, {0x1048215f0, 0x1400020e0f0}, 0x140001f63c0)
        /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/streamable.go:215 +0x7e0
net/http.serverHandler.ServeHTTP({0x10481ff88?}, {0x1048215f0?, 0x1400020e0f0?}, 0x1?)
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3340 +0xb0
net/http.(*conn).serve(0x140001e25a0, {0x1048226b8, 0x140002580f0})
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:2109 +0x528
created by net/http.(*Server).Serve in goroutine 35
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3493 +0x384
2025/10/19 03:04:31 http: panic serving [::1]:55179: AddTool: tool "create_task": input schema: ForType(tools.CreateTaskInput): tag must not begin with 'WORD=': "enum=TODO,enum=IN_PROGRESS,enum=DONE"
goroutine 40 [running]:
net/http.(*conn).serve.func1()
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:1943 +0xb4
panic({0x104763e40?, 0x1400048d120?})
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/runtime/panic.go:783 +0x120
github.com/modelcontextprotocol/go-sdk/mcp.AddTool[...](0x140001ce240?, 0x1400003b908, 0x0)
        /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/server.go:400 +0xbc
github.com/linehaul/twenty-crm-mcp-http/internal/tools.RegisterTaskTools(0x140001ce240, 0x140001efd10)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/tools/tasks.go:32 +0xb0
github.com/linehaul/twenty-crm-mcp-http/internal/server.NewMCPServer(0x140001efd10)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/server/server.go:24 +0x8c
main.main.func1(0x140003ceae0?)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/cmd/server/main.go:45 +0x20
github.com/modelcontextprotocol/go-sdk/mcp.(*StreamableHTTPHandler).ServeHTTP(0x140001efda0, {0x1048215f0, 0x1400020e4b0}, 0x140001f6dc0)
        /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/streamable.go:215 +0x7e0
net/http.serverHandler.ServeHTTP({0x10481ff88?}, {0x1048215f0?, 0x1400020e4b0?}, 0x1?)
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3340 +0xb0
net/http.(*conn).serve(0x140003d6630, {0x1048226b8, 0x140002580f0})
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:2109 +0x528
created by net/http.(*Server).Serve in goroutine 35
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3493 +0x384
2025/10/19 03:04:40 http: panic serving [::1]:55184: AddTool: tool "create_task": input schema: ForType(tools.CreateTaskInput): tag must not begin with 'WORD=': "enum=TODO,enum=IN_PROGRESS,enum=DONE"
goroutine 19 [running]:
net/http.(*conn).serve.func1()
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:1943 +0xb4
panic({0x104763e40?, 0x14000322c90?})
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/runtime/panic.go:783 +0x120
github.com/modelcontextprotocol/go-sdk/mcp.AddTool[...](0x140001ce000?, 0x1400003b908, 0x0)
        /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/server.go:400 +0xbc
github.com/linehaul/twenty-crm-mcp-http/internal/tools.RegisterTaskTools(0x140001ce000, 0x140001efd10)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/tools/tasks.go:32 +0xb0
github.com/linehaul/twenty-crm-mcp-http/internal/server.NewMCPServer(0x140001efd10)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/server/server.go:24 +0x8c
main.main.func1(0x140001efcb0?)
        /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/cmd/server/main.go:45 +0x20
github.com/modelcontextprotocol/go-sdk/mcp.(*StreamableHTTPHandler).ServeHTTP(0x140001efda0, {0x1048215f0, 0x1400020e000}, 0x14000000140)
        /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/streamable.go:215 +0x7e0
net/http.serverHandler.ServeHTTP({0x10481ff88?}, {0x1048215f0?, 0x1400020e000?}, 0x1?)
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3340 +0xb0
net/http.(*conn).serve(0x1400041a990, {0x1048226b8, 0x140002580f0})
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:2109 +0x528
created by net/http.(*Server).Serve in goroutine 35
        /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3493 +0x384

“client”:

fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 
➜    # Test 1: Initialize
  curl -X POST http://localhost:8080 \                                                                                                                                   
    -H "Content-Type: application/json" \
fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 
➜     curl -X POST http://localhost:8080 \
>     -H "Content-Type: application/json" \
>     -d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}},"id":1}'
curl: (52) Empty reply from server
fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 
➜   # Test 2: List tools
  curl -X POST http://localhost:8080 \                                                                                                                                   
    -H "Content-Type: application/json" \
fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 
➜     curl -X POST http://localhost:8080 \
>     -H "Content-Type: application/json" \
>     -d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":2}'
curl: (52) Empty reply from server
fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 
➜   # Test 3: Call search_contacts
  curl -X POST http://localhost:8080 \                                                                                                                                   
    -H "Content-Type: application/json" \
fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 
➜     curl -X POST http://localhost:8080 \
>     -H "Content-Type: application/json" \
>     -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"search_contacts","arguments":{"query":"test","limit":5}},"id":3}'
curl: (52) Empty reply from server
fakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ 

Use context7 mcp server to lookup. any of the Twenty or MCP GO SDK documentation

Agent Context { "tasks": [ { "id": "831a9066-b967-43c5-9bcf-2a920c5df432", "taskIndex": 0, "request": "[original issue]\n**MCP Server Initialization Failure: Enum Tag Validation Error in Tool Registration**\nI’m trying to create a HTTP MCP server w/ the go SDK. \n\nPlease analyze these testing logs:\n\n“host”:\n```\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n➜ ./twenty-crm-mcp-server\n2025/10/19 03:04:10 Starting Twenty CRM MCP HTTP Server on 0.0.0.0:8080\n2025/10/19 03:04:10 MCP endpoint: http://0.0.0.0:8080/mcp\n2025/10/19 03:04:22 http: panic serving [::1]:55176: AddTool: tool \"create_task\": input schema: ForType(tools.CreateTaskInput): tag must not begin with 'WORD=': \"enum=TODO,enum=IN_PROGRESS,enum=DONE\"\ngoroutine 38 [running]:\nnet/http.(*conn).serve.func1()\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:1943 +0xb4\npanic({0x104763e40?, 0x140003da120?})\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/runtime/panic.go:783 +0x120\ngithub.com/modelcontextprotocol/go-sdk/mcp.AddTool[...](0x140001ce180?, 0x1400003b908, 0x0)\n /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/server.go:400 +0xbc\ngithub.com/linehaul/twenty-crm-mcp-http/internal/tools.RegisterTaskTools(0x140001ce180, 0x140001efd10)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/tools/tasks.go:32 +0xb0\ngithub.com/linehaul/twenty-crm-mcp-http/internal/server.NewMCPServer(0x140001efd10)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/server/server.go:24 +0x8c\nmain.main.func1(0x14000258210?)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/cmd/server/main.go:45 +0x20\ngithub.com/modelcontextprotocol/go-sdk/mcp.(*StreamableHTTPHandler).ServeHTTP(0x140001efda0, {0x1048215f0, 0x1400020e0f0}, 0x140001f63c0)\n /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/streamable.go:215 +0x7e0\nnet/http.serverHandler.ServeHTTP({0x10481ff88?}, {0x1048215f0?, 0x1400020e0f0?}, 0x1?)\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3340 +0xb0\nnet/http.(*conn).serve(0x140001e25a0, {0x1048226b8, 0x140002580f0})\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:2109 +0x528\ncreated by net/http.(*Server).Serve in goroutine 35\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3493 +0x384\n2025/10/19 03:04:31 http: panic serving [::1]:55179: AddTool: tool \"create_task\": input schema: ForType(tools.CreateTaskInput): tag must not begin with 'WORD=': \"enum=TODO,enum=IN_PROGRESS,enum=DONE\"\ngoroutine 40 [running]:\nnet/http.(*conn).serve.func1()\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:1943 +0xb4\npanic({0x104763e40?, 0x1400048d120?})\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/runtime/panic.go:783 +0x120\ngithub.com/modelcontextprotocol/go-sdk/mcp.AddTool[...](0x140001ce240?, 0x1400003b908, 0x0)\n /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/server.go:400 +0xbc\ngithub.com/linehaul/twenty-crm-mcp-http/internal/tools.RegisterTaskTools(0x140001ce240, 0x140001efd10)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/tools/tasks.go:32 +0xb0\ngithub.com/linehaul/twenty-crm-mcp-http/internal/server.NewMCPServer(0x140001efd10)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/server/server.go:24 +0x8c\nmain.main.func1(0x140003ceae0?)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/cmd/server/main.go:45 +0x20\ngithub.com/modelcontextprotocol/go-sdk/mcp.(*StreamableHTTPHandler).ServeHTTP(0x140001efda0, {0x1048215f0, 0x1400020e4b0}, 0x140001f6dc0)\n /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/streamable.go:215 +0x7e0\nnet/http.serverHandler.ServeHTTP({0x10481ff88?}, {0x1048215f0?, 0x1400020e4b0?}, 0x1?)\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3340 +0xb0\nnet/http.(*conn).serve(0x140003d6630, {0x1048226b8, 0x140002580f0})\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:2109 +0x528\ncreated by net/http.(*Server).Serve in goroutine 35\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3493 +0x384\n2025/10/19 03:04:40 http: panic serving [::1]:55184: AddTool: tool \"create_task\": input schema: ForType(tools.CreateTaskInput): tag must not begin with 'WORD=': \"enum=TODO,enum=IN_PROGRESS,enum=DONE\"\ngoroutine 19 [running]:\nnet/http.(*conn).serve.func1()\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:1943 +0xb4\npanic({0x104763e40?, 0x14000322c90?})\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/runtime/panic.go:783 +0x120\ngithub.com/modelcontextprotocol/go-sdk/mcp.AddTool[...](0x140001ce000?, 0x1400003b908, 0x0)\n /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/server.go:400 +0xbc\ngithub.com/linehaul/twenty-crm-mcp-http/internal/tools.RegisterTaskTools(0x140001ce000, 0x140001efd10)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/tools/tasks.go:32 +0xb0\ngithub.com/linehaul/twenty-crm-mcp-http/internal/server.NewMCPServer(0x140001efd10)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/internal/server/server.go:24 +0x8c\nmain.main.func1(0x140001efcb0?)\n /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP/cmd/server/main.go:45 +0x20\ngithub.com/modelcontextprotocol/go-sdk/mcp.(*StreamableHTTPHandler).ServeHTTP(0x140001efda0, {0x1048215f0, 0x1400020e000}, 0x14000000140)\n /Users/fakebizprez/go/pkg/mod/github.com/modelcontextprotocol/[email protected]/mcp/streamable.go:215 +0x7e0\nnet/http.serverHandler.ServeHTTP({0x10481ff88?}, {0x1048215f0?, 0x1400020e000?}, 0x1?)\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3340 +0xb0\nnet/http.(*conn).serve(0x1400041a990, {0x1048226b8, 0x140002580f0})\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:2109 +0x528\ncreated by net/http.(*Server).Serve in goroutine 35\n /opt/homebrew/Cellar/go/1.25.3/libexec/src/net/http/server.go:3493 +0x384\n```\n\n“client”:\n\n```\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n➜ # Test 1: Initialize\n curl -X POST http://localhost:8080 \\ \n -H \"Content-Type: application/json\" \\\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n➜ curl -X POST http://localhost:8080 \\\n> -H \"Content-Type: application/json\" \\\n> -d '{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"test\",\"version\":\"1.0.0\"}},\"id\":1}'\ncurl: (52) Empty reply from server\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n➜ # Test 2: List tools\n curl -X POST http://localhost:8080 \\ \n -H \"Content-Type: application/json\" \\\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n➜ curl -X POST http://localhost:8080 \\\n> -H \"Content-Type: application/json\" \\\n> -d '{\"jsonrpc\":\"2.0\",\"method\":\"tools/list\",\"params\":{},\"id\":2}'\ncurl: (52) Empty reply from server\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n➜ # Test 3: Call search_contacts\n curl -X POST http://localhost:8080 \\ \n -H \"Content-Type: application/json\" \\\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n➜ curl -X POST http://localhost:8080 \\\n> -H \"Content-Type: application/json\" \\\n> -d '{\"jsonrpc\":\"2.0\",\"method\":\"tools/call\",\"params\":{\"name\":\"search_contacts\",\"arguments\":{\"query\":\"test\",\"limit\":5}},\"id\":3}'\ncurl: (52) Empty reply from server\nfakebizprez@scum-studio: /Users/fakebizprez/Developer/repositories/twentyCRM-MCP-HTTP git:(feature-rich) ✗ \n```\n\nUse context7 mcp server to lookup. any of the Twenty or MCP GO SDK documentation", "title": "Fix MCP Server Enum Tag Validation Error in Tool Registration", "createdAt": 1760976297451, "completed": false, "planRevisions": [ { "revisionIndex": 0, "plans": [ { "index": 0, "plan": "**Identify and fix the invalid enum struct tag in the CreateTaskInput struct** - Locate the `internal/tools/tasks.go` file and remove the invalid `enum=TODO,enum=IN_PROGRESS,enum=DONE` struct tag from the Status field, replacing it with a simple `jsonschema:\"description=Task status\"` tag since the Go MCP SDK doesn't support enum values directly via struct tags.", "completed": false }, { "index": 1, "plan": "**Implement programmatic enum schema modification** - After the `mcp.AddTool()` call in the `RegisterTaskTools` function in `internal/tools/tasks.go`, add code to programmatically set the enum values by accessing `tool.InputSchema.Properties[\"status\"].Enum = []any{\"TODO\", \"IN_PROGRESS\", \"DONE\"}` to properly define the allowed status values.", "completed": false }, { "index": 2, "plan": "**Test the MCP server initialization and tool registration** - Build and run the server to verify that the enum tag validation error is resolved, the server starts successfully on port 8080, and the tools/list endpoint returns the create_task tool with proper enum constraints in the input schema.", "completed": false }, { "index": 3, "plan": "**Verify HTTP MCP endpoint functionality** - Test the server using curl commands to ensure the initialize, tools/list, and tools/call methods work correctly without the previous panic errors, confirming that clients can successfully connect and interact with the MCP server.", "completed": false } ], "createdAt": 1760976297451, "createdBy": "agent" } ], "activeRevisionIndex": 0 } ], "activeTaskIndex": 0 } [ "**Identify and fix the invalid enum struct tag in the CreateTaskInput struct** - Locate the `internal/tools/tasks.go` file and remove the invalid `enum=TODO,enum=IN_PROGRESS,enum=DONE` struct tag from the Status field, replacing it with a simple `jsonschema:\"description=Task status\"` tag since the Go MCP SDK doesn't support enum values directly via struct tags.", "**Implement programmatic enum schema modification** - After the `mcp.AddTool()` call in the `RegisterTaskTools` function in `internal/tools/tasks.go`, add code to programmatically set the enum values by accessing `tool.InputSchema.Properties[\"status\"].Enum = []any{\"TODO\", \"IN_PROGRESS\", \"DONE\"}` to properly define the allowed status values.", "**Test the MCP server initialization and tool registration** - Build and run the server to verify that the enum tag validation error is resolved, the server starts successfully on port 8080, and the tools/list endpoint returns the create_task tool with proper enum constraints in the input schema.", "**Verify HTTP MCP endpoint functionality** - Test the server using curl commands to ensure the initialize, tools/list, and tools/call methods work correctly without the previous panic errors, confirming that clients can successfully connect and interact with the MCP server." ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions