internal/mcp/design: further clean-up
Do a pass through the design doc, adding a bit more clean-up and commentary. Additionally, update ServerTool and ServerPrompt to be consistent with the design. Change-Id: I1b75c4690d86fe8946d512cb36a1fc2938b3c883 Reviewed-on: https://go-review.googlesource.com/c/tools/+/672576 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Auto-Submit: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
0b09f3ad5a
commit
7eadde0a23
1 changed files with 168 additions and 121 deletions
|
|
@ -53,8 +53,8 @@ func NewServer(name, version string, opts *ServerOptions) *Server {
|
|||
name: name,
|
||||
version: version,
|
||||
opts: *opts,
|
||||
prompts: newFeatureSet(func(p *ServerPrompt) string { return p.Definition.Name }),
|
||||
tools: newFeatureSet(func(t *ServerTool) string { return t.Definition.Name }),
|
||||
prompts: newFeatureSet(func(p *ServerPrompt) string { return p.Prompt.Name }),
|
||||
tools: newFeatureSet(func(t *ServerTool) string { return t.Tool.Name }),
|
||||
resources: newFeatureSet(func(r *ServerResource) string { return r.Resource.URI }),
|
||||
}
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ func (s *Server) listPrompts(_ context.Context, _ *ServerSession, params *ListPr
|
|||
defer s.mu.Unlock()
|
||||
res := new(ListPromptsResult)
|
||||
for p := range s.prompts.all() {
|
||||
res.Prompts = append(res.Prompts, p.Definition)
|
||||
res.Prompts = append(res.Prompts, p.Prompt)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ func (s *Server) listTools(_ context.Context, _ *ServerSession, params *ListTool
|
|||
defer s.mu.Unlock()
|
||||
res := new(ListToolsResult)
|
||||
for t := range s.tools.all() {
|
||||
res.Tools = append(res.Tools, t.Definition)
|
||||
res.Tools = append(res.Tools, t.Tool)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue