code-mode icon indicating copy to clipboard operation
code-mode copied to clipboard

JSON schema issue

Open mattepiu opened this issue 1 year ago • 4 comments

Opencode + local gtp-OSS-20B

It fails "in LLM", locallama reports: srv log_server_r: request: POST /v1/chat/completions 127.0.0.1 500 got exception: {"code":500,"message":"JSON schema conversion failed:\nUnrecognized schema: {"description":"The call template for the UTCP Manual endpoint."}\nUnrecognized schema: {"description":"The call template for the UTCP Manual endpoint."}","type":"server_error"} srv log_server_r: request: POST /v1/chat/completions 127.0.0.1 500 got exception: {"code":500,"message":"JSON schema conversion failed:\nUnrecognized schema: {"description":"The call template for the UTCP Manual endpoint."}\nUnrecognized schema: {"description":"The call template for the UTCP Manual endpoint."}","type":"server_error"} srv log_server_r: request: POST /v1/chat/completions 127.0.0.1 500 got exception: {"code":500,"message":"JSON schema conversion failed:\nUnrecognized schema: {"description":"The call template for the UTCP Manual endpoint."}\nUnrecognized schema: {"description":"The call template for the UTCP Manual endpoint."}","type":"server_error"}

Setup in opencode config: (same as serena and other mcp tools) "code-mode": { "type": "local", "command": ["npx", "@utcp/code-mode-mcp"], "enabled": true, "environment": { "UTCP_CONFIG_FILE": "mcp\.utcp_config.json" } }

in .utcp_config.json: { "load_variables_from": [ { "variable_loader_type": "dotenv", "env_file_path": ".env" } ], "tool_repository": { "tool_repository_type": "in_memory" }, "tool_search_strategy": { "tool_search_strategy_type": "tag_and_description_word_match" }, "manual_call_templates": [ { "name": "openlibrary", "call_template_type": "http", "http_method": "GET", "url": "https://openlibrary.org/static/openapi.json", "content_type": "application/json" } ], "post_processing": [ ] }

mattepiu avatar Nov 19 '25 10:11 mattepiu

Could you try to load this in the mcp inspector and see if it works there: https://github.com/modelcontextprotocol/inspector

h3xxit avatar Nov 24 '25 15:11 h3xxit

I think issue is in docs:

npm install @utcp/code-mode-mcp

and then in opencode run as local:

npm @utcp/code-mode

And it loads without json issue, but then connection closed.

mattepiu avatar Dec 17 '25 13:12 mattepiu

Inspector seems to work to reach openlibrary tools, but says this(seems related):

Received POST message for sessionId 4f6208d8-f7eb-420c-9c7e-872cb5286b4c Error from MCP server: SyntaxError: Unexpected token 'H', "[HttpCommun"... is not valid JSON at JSON.parse () at deserializeMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44) at ReadBuffer.readMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16) at StdioClientTransport.processReadBuffer (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:126:50) at Socket. (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:92:22) at Socket.emit (node:events:518:28) at addChunk (node:internal/streams/readable:561:12) at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) at Readable.push (node:internal/streams/readable:392:5) at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) Error from MCP server: SyntaxError: Unexpected token 'H', "[HttpCommun"... is not valid JSON at JSON.parse () at deserializeMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44) at ReadBuffer.readMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16) at StdioClientTransport.processReadBuffer (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:126:50) at Socket. (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:92:22) at Socket.emit (node:events:518:28) at addChunk (node:internal/streams/readable:561:12) at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) at Readable.push (node:internal/streams/readable:392:5) at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) Error from MCP server: SyntaxError: Unexpected token 'H', "[HttpCommun"... is not valid JSON at JSON.parse () at deserializeMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44) at ReadBuffer.readMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16) at StdioClientTransport.processReadBuffer (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:126:50) at Socket. (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:92:22) at Socket.emit (node:events:518:28) at addChunk (node:internal/streams/readable:561:12) at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) at Readable.push (node:internal/streams/readable:392:5) at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) Error from MCP server: SyntaxError: Unexpected token 'S', "Successful"... is not valid JSON at JSON.parse () at deserializeMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:26:44) at ReadBuffer.readMessage (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js:19:16) at StdioClientTransport.processReadBuffer (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:126:50) at Socket. (file:///C:/Users/Me/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js:92:22) at Socket.emit (node:events:518:28) at addChunk (node:internal/streams/readable:561:12) at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) at Readable.push (node:internal/streams/readable:392:5) at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) Received POST message for sessionId 4f6208d8-f7eb-420c-9c7e-872cb5286b4c Received POST message for sessionId 4f6208d8-f7eb-420c-9c7e-872cb5286b4c Received POST message for sessionId 4f6208d8-f7eb-420c-9c7e-872cb5286b4c Received POST message for sessionId 4f6208d8-f7eb-420c-9c7e-872cb5286b4c Received POST message for sessionId 4f6208d8-f7eb-420c-9c7e-872cb5286b4c

through gateway maybe working with the configuration:

"gateway":{
  "type": "local",
  "command": ["npx", "-y", "utcp-mcp-gateway" ],
  "environment": {
       "MCP_COMMAND": "npx",
       "MCP_ARGS": "-y,@utcp/code-mode-mcp",
       "MCP_NAME": "code-mode",
       "MCP_TRANSPORT": "stdio",
       "UTCP_CONFIG_FILE": "C:\\Users\\me\\mcp\\.utcp_config.json"
  }
}

further testing in next days.

mattepiu avatar Dec 17 '25 13:12 mattepiu

Still not working, it sees code mode tools like code_mode_code_mode_search_tools but doesn't seem able to use them

mattepiu avatar Dec 22 '25 13:12 mattepiu