MCPcopy Create free account
hub / github.com/compozy/agh / SearchSessionTools

Method SearchSessionTools

internal/api/core/tools.go:199–234  ·  view source on GitHub ↗

SearchSessionTools searches only within the session/model-callable projection.

(c *gin.Context)

Source from the content-addressed store, hash-verified

197
198// SearchSessionTools searches only within the session/model-callable projection.
199func (h *BaseHandlers) SearchSessionTools(c *gin.Context) {
200 req, ok := h.bindToolSearch(c)
201 if !ok {
202 return
203 }
204 if h.Tools == nil {
205 h.respondError(c, http.StatusServiceUnavailable, errors.New("tool registry is not configured"))
206 return
207 }
208 routeScope, routeSessionID, _, ok := h.routeSessionInWorkspace(c)
209 if !ok {
210 return
211 }
212 scope := h.sessionToolScope(c, routeScope.ID, routeSessionID)
213 if reqWorkspaceID := strings.TrimSpace(
214 req.WorkspaceID,
215 ); reqWorkspaceID != "" &&
216 reqWorkspaceID != scope.WorkspaceID {
217 h.respondError(c, http.StatusBadRequest, errors.New("workspace_id does not match path"))
218 return
219 }
220 if reqSessionID := strings.TrimSpace(req.SessionID); reqSessionID != "" && reqSessionID != scope.SessionID {
221 h.respondError(c, http.StatusBadRequest, errors.New("session_id does not match path"))
222 return
223 }
224 scope.AgentName = firstNonEmpty(req.AgentName, scope.AgentName)
225 views, err := h.Tools.Search(c.Request.Context(), scope, toolspkg.SearchQuery{
226 Query: req.Query,
227 Limit: req.Limit,
228 })
229 if err != nil {
230 h.respondToolError(c, err)
231 return
232 }
233 c.JSON(http.StatusOK, contract.ToolsResponse{Tools: ToolPayloadsFromViews(views)})
234}
235
236// ListToolsets returns named toolsets with expansion diagnostics.
237func (h *BaseHandlers) ListToolsets(c *gin.Context) {

Callers

nothing calls this directly

Calls 8

bindToolSearchMethod · 0.95
respondErrorMethod · 0.95
sessionToolScopeMethod · 0.95
respondToolErrorMethod · 0.95
ToolPayloadsFromViewsFunction · 0.85
firstNonEmptyFunction · 0.70
SearchMethod · 0.65

Tested by

no test coverage detected