internal/mcp: rename Make* to New*
Change-Id: I8d3d2ca125b7c24dd265937c4fe910ea823ab811 Reviewed-on: https://go-review.googlesource.com/c/tools/+/670537 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
9031106300
commit
e0e304e51e
1 changed files with 32 additions and 32 deletions
|
|
@ -38,18 +38,18 @@ func TestEndToEnd(t *testing.T) {
|
|||
s := NewServer("testServer", "v1.0.0", nil)
|
||||
|
||||
// The 'greet' tool says hi.
|
||||
s.AddTools(MakeTool("greet", "say hi", sayHi))
|
||||
s.AddTools(NewTool("greet", "say hi", sayHi))
|
||||
|
||||
// The 'fail' tool returns this error.
|
||||
failure := errors.New("mcp failure")
|
||||
s.AddTools(
|
||||
MakeTool("fail", "just fail", func(context.Context, *ClientConnection, struct{}) ([]Content, error) {
|
||||
NewTool("fail", "just fail", func(context.Context, *ClientConnection, struct{}) ([]Content, error) {
|
||||
return nil, failure
|
||||
}),
|
||||
)
|
||||
|
||||
s.AddPrompts(
|
||||
MakePrompt("code_review", "do a code review", func(_ context.Context, _ *ClientConnection, params struct{ Code string }) (*protocol.GetPromptResult, error) {
|
||||
NewPrompt("code_review", "do a code review", func(_ context.Context, _ *ClientConnection, params struct{ Code string }) (*protocol.GetPromptResult, error) {
|
||||
return &protocol.GetPromptResult{
|
||||
Description: "Code review prompt",
|
||||
Messages: []protocol.PromptMessage{
|
||||
|
|
@ -57,7 +57,7 @@ func TestEndToEnd(t *testing.T) {
|
|||
},
|
||||
}, nil
|
||||
}),
|
||||
MakePrompt("fail", "", func(_ context.Context, _ *ClientConnection, params struct{}) (*protocol.GetPromptResult, error) {
|
||||
NewPrompt("fail", "", func(_ context.Context, _ *ClientConnection, params struct{}) (*protocol.GetPromptResult, error) {
|
||||
return nil, failure
|
||||
}),
|
||||
)
|
||||
|
|
@ -218,7 +218,7 @@ func basicConnection(t *testing.T, tools ...*Tool) (*ClientConnection, *Client)
|
|||
}
|
||||
|
||||
func TestServerClosing(t *testing.T) {
|
||||
cc, c := basicConnection(t, MakeTool("greet", "say hi", sayHi))
|
||||
cc, c := basicConnection(t, NewTool("greet", "say hi", sayHi))
|
||||
defer c.Close()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -293,7 +293,7 @@ func TestCancellation(t *testing.T) {
|
|||
}
|
||||
return nil, nil
|
||||
}
|
||||
_, sc := basicConnection(t, MakeTool("slow", "a slow request", slowRequest))
|
||||
_, sc := basicConnection(t, NewTool("slow", "a slow request", slowRequest))
|
||||
defer sc.Close()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
|
|
|||
Loading…
Reference in a new issue