internal/mcp: resource tweaks
Get the name and signature of the handler right. Change-Id: I743aaaee45cc07a741ab8ad16e90e1b1d5519b64 Reviewed-on: https://go-review.googlesource.com/c/tools/+/672336 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
3c09cbb2d5
commit
81a8ece2dd
1 changed files with 47 additions and 38 deletions
|
|
@ -198,15 +198,15 @@ func TestEndToEnd(t *testing.T) {
|
|||
URI: "file:///nonexistent.txt",
|
||||
}
|
||||
|
||||
readHandler := func(_ context.Context, r *Resource, _ *ReadResourceParams) (*ReadResourceResult, error) {
|
||||
if r.URI == "file:///file1.txt" {
|
||||
readHandler := func(_ context.Context, _ *ServerConnection, p *ReadResourceParams) (*ReadResourceResult, error) {
|
||||
if p.URI == "file:///file1.txt" {
|
||||
return &ReadResourceResult{
|
||||
Contents: &ResourceContents{
|
||||
Text: "file contents",
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
return nil, ResourceNotFoundError(r.URI)
|
||||
return nil, ResourceNotFoundError(p.URI)
|
||||
}
|
||||
s.AddResources(
|
||||
&ServerResource{resource1, readHandler},
|
||||
|
|
|
|||
Loading…
Reference in a new issue