MCPcopy Index your code
hub / github.com/coder/coder / RecordToolUsage

Method RecordToolUsage

coderd/aibridged/translator.go:90–114  ·  view source on GitHub ↗
(ctx context.Context, req *aibridge.ToolUsageRecord)

Source from the content-addressed store, hash-verified

88}
89
90func (t *recorderTranslation) RecordToolUsage(ctx context.Context, req *aibridge.ToolUsageRecord) error {
91 serialized, err := json.Marshal(req.Args)
92 if err != nil {
93 return xerrors.Errorf("serialize tool %q args: %w", req.Tool, err)
94 }
95
96 var invErr *string
97 if req.InvocationError != nil {
98 invErr = ptr.Ref(req.InvocationError.Error())
99 }
100
101 _, err = t.client.RecordToolUsage(ctx, &proto.RecordToolUsageRequest{
102 InterceptionId: req.InterceptionID,
103 MsgId: req.MsgID,
104 ToolCallId: req.ToolCallID,
105 ServerUrl: req.ServerURL,
106 Tool: req.Tool,
107 Input: string(serialized),
108 Injected: req.Injected,
109 InvocationError: invErr,
110 Metadata: marshalForProto(req.Metadata),
111 CreatedAt: timestamppb.New(req.CreatedAt),
112 })
113 return err
114}
115
116func (t *recorderTranslation) RecordModelThought(ctx context.Context, req *aibridge.ModelThoughtRecord) error {
117 _, err := t.client.RecordModelThought(ctx, &proto.RecordModelThoughtRequest{

Callers

nothing calls this directly

Calls 7

RefFunction · 0.92
marshalForProtoFunction · 0.85
RecordToolUsageMethod · 0.65
NewMethod · 0.65
MarshalMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected