Skip to content

Conversation

@burmudar
Copy link
Contributor

@burmudar burmudar commented Nov 28, 2025

  • basic sse resposne parsing
  • remove zero / nil arguments before making the request

Part of SRCH-2167

Test plan

Tested with go run ./cmd/src mcp commit-search -repos "sourcegraph/sourcegraph" -count 1 | tail -n 1 | jq

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"query\":\"type:commit repo:sourcegraph/sourcegraph count:1\",\"totalCount\":1,\"commits\":[{\"repository\":\"github.com/sourcegraph/sourcegraph\",\"commit\":\"7cf5c82\",\"author\":\"Erik Seliger \\u003cerikseliger@me.com\\u003e\",\"date\":\"2025-11-28\",\"title\":\"Remove enable-simple-search (#8064)\",\"message\":\"Remove enable-simple-search (#8064)\\n\\nNot polished, never moved out of experimental, not implemented in\\nSvelte.\"}],\"limitHit\":true}"
      }
    ],
    "structuredContent": {
      "commits": [
        {
          "author": "Erik Seliger <erikseliger@me.com>",
          "commit": "7cf5c82",
          "date": "2025-11-28",
          "message": "Remove enable-simple-search (#8064)\n\nNot polished, never moved out of experimental, not implemented in\nSvelte.",
          "repository": "github.com/sourcegraph/sourcegraph",
          "title": "Remove enable-simple-search (#8064)"
        }
      ],
      "limitHit": true,
      "query": "type:commit repo:sourcegraph/sourcegraph count:1",
      "totalCount": 1
    }
  }
}

@burmudar
Copy link
Contributor Author

burmudar commented Nov 28, 2025

@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from d7c8949 to 09ac776 Compare December 1, 2025 08:24
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from c93e6a0 to 619a3a0 Compare December 2, 2025 09:46
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from 09ac776 to e94f2f9 Compare December 2, 2025 09:46
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from 619a3a0 to c3d97d0 Compare December 2, 2025 10:11
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from e94f2f9 to 312d44d Compare December 2, 2025 10:11
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from c3d97d0 to 90c48d3 Compare December 2, 2025 12:46
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from 312d44d to 46d4204 Compare December 2, 2025 12:46
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from 90c48d3 to 1c9d1aa Compare December 2, 2025 14:44
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from e61a429 to 8f3a1ee Compare December 2, 2025 14:45
@burmudar burmudar changed the title make json rpc 2.0 call based on cli args feat(mcp): do mcp tool call from cli args Dec 2, 2025
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch 3 times, most recently from 011a0a1 to 2faa5c1 Compare December 2, 2025 15:26
@burmudar burmudar marked this pull request as ready for review December 2, 2025 15:33
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from f752670 to d72c626 Compare December 4, 2025 09:43
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from 2faa5c1 to e853a4d Compare December 4, 2025 09:43
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from d72c626 to 9618084 Compare December 5, 2025 09:35
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from e853a4d to e949ce0 Compare December 5, 2025 09:35
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from 9618084 to 20554e0 Compare December 5, 2025 10:19
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from e949ce0 to 2d1ac17 Compare December 5, 2025 10:19
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from 20554e0 to 236e972 Compare December 5, 2025 10:25
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from 2d1ac17 to 99f8eb5 Compare December 5, 2025 10:25
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from 236e972 to 1848af5 Compare December 5, 2025 10:30
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from 99f8eb5 to 57870c5 Compare December 5, 2025 10:30
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from abd791a to 8c0a165 Compare December 5, 2025 10:50
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from 1848af5 to 28e14ec Compare December 8, 2025 10:08
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from 8c0a165 to aaa4985 Compare December 8, 2025 10:08
@burmudar burmudar force-pushed the wb/mcp-flagset-inputschema branch from 28e14ec to 7bc3f56 Compare December 8, 2025 10:21
@burmudar burmudar force-pushed the wb/mcp-http-tool-call branch from aaa4985 to 81a073e Compare December 8, 2025 10:21
@burmudar burmudar self-assigned this Dec 8, 2025
Copy link
Member

@keegancsmith keegancsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to see some tool calls!

}

func DecodeToolResponse(resp *http.Response) (map[string]json.RawMessage, error) {
data, err := readSSEResponseData(resp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought our server was just http not sse. But then again we use some framework that I guess decides for us?

@burmudar burmudar merged commit b5e8e6f into wb/mcp-flagset-inputschema Dec 9, 2025
9 checks passed
@burmudar burmudar deleted the wb/mcp-http-tool-call branch December 9, 2025 07:51
burmudar added a commit that referenced this pull request Dec 9, 2025
* make json rpc 2.0 call based on cli args

- basic sse resposne parsing
- remove zero / nil arguments before making the request

* move tool request to mcp_request.go

* print tool response according to output schema

* print structuredContent from JSON RPC response

* only register mcp command if SRC_EXPERIMENT_MCP=true

* rename ParseToolResponse to DecodeToolResponse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants