Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

fix json rpc id lookups

Justin D'Souza0e654b1c554e
diff --git a/cli/beacon-hooks/cmd/endpoint_events.go b/cli/beacon-hooks/cmd/endpoint_events.go
index eff3da05..beade60a 100644
--- a/cli/beacon-hooks/cmd/endpoint_events.go
+++ b/cli/beacon-hooks/cmd/endpoint_events.go
@@ -280,7 +280,7 @@ func mcpStandardFields(toolInput, toolResponse map[string]interface{}) map[strin
fields["error"] = map[string]interface{}{"type": errorType}
}
jsonrpc := map[string]interface{}{}
- if id := firstToolStringAcross(maps, "jsonrpc.request.id", "jsonrpc_request_id", "request_id", "id"); id != "" {
+ if id := firstToolStringAcross(maps, "jsonrpc.request.id", "jsonrpc_request_id", "request_id"); id != "" {
jsonrpc["request"] = map[string]interface{}{"id": id}
}
if version := firstToolStringAcross(maps, "jsonrpc.protocol.version", "jsonrpc_protocol_version", "jsonrpc"); version != "" {
diff --git a/cli/beacon-hooks/cmd/endpoint_events_test.go b/cli/beacon-hooks/cmd/endpoint_events_test.go
index ffe74e6e..2bd16a0d 100644
--- a/cli/beacon-hooks/cmd/endpoint_events_test.go
+++ b/cli/beacon-hooks/cmd/endpoint_events_test.go
@@ -105,6 +105,20 @@ func TestToolFieldsMapsMCPTransportContext(t *testing.T) {
}
}
+func TestToolFieldsDoesNotTreatMCPArgumentIDAsJSONRPCRequestID(t *testing.T) {
+ fields := toolFields("MCP:get_issue", map[string]interface{}{
+ "id": "issue-123",
+ "name": "Release blocker",
+ })
+ jsonrpc, ok := fields["jsonrpc"].(map[string]interface{})
+ if !ok {
+ return
+ }
+ if request, ok := jsonrpc["request"]; ok {
+ t.Fatalf("jsonrpc.request = %#v, want no request from generic tool argument id", request)
+ }
+}
+
func TestToolFieldsIgnoresFalseMCPErrorField(t *testing.T) {
fields := toolFieldsWithResponse("MCP:get_organizations", map[string]interface{}{}, map[string]interface{}{
"error": false,