Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ var rootCmd = &cobra.Command{
"components",
mcp.WithDescription(`Filter and retrieve components in the OpsLevel catalog. Use as specific a filter as possible to narrow down results and avoid fetching a high number of components.

Components represent services, APIs, libraries, and other software artifacts with metadata such as owner (Team), language, framework, maturity level, lifecycle stage, and tier. Lower tier_index indicates greater criticality. Lower level_index indicates lower maturity level (e.g. Bronze=0, Silver=1, Gold=2).
Components represent services, APIs, libraries, and other software artifacts with metadata such as owner (Team), language, framework, maturity level, lifecycle stage, and tier. Lower tier_index indicates greater criticality. Lower level_index indicates lower maturity level (e.g. Bronze="0", Silver="1", Gold="2").

Use the 'filter' parameter to narrow down results.
Use the 'filter' parameter to narrow down results. 'filter' "arg" must always be a string.
For simple filters:
{ "key": "name", "type": "equals", "arg": "service-name" }

Expand Down Expand Up @@ -302,16 +302,17 @@ For complete reference:
if filterObj, exists := args["filter"]; exists && filterObj != nil {
// Marshal then unmarshal to our struct for type safety
filterBytes, marshalErr := json.Marshal(filterObj)
if marshalErr == nil {
var f componentFilter
if unmarshalErr := json.Unmarshal(filterBytes, &f); unmarshalErr == nil {
filterInput = &f
}
if marshalErr != nil {
return mcp.NewToolResultErrorFromErr("failed to marshal filter argument", marshalErr), nil
}
var f componentFilter
if unmarshalErr := json.Unmarshal(filterBytes, &f); unmarshalErr != nil {
return mcp.NewToolResultErrorFromErr("failed to unmarshal filter argument", unmarshalErr), nil
}
filterInput = &f
}

if filterInput != nil {
// Convert to ServiceFilterInput for the API
serviceFilter, convertErr := convertToServiceFilterInput(*filterInput)
if convertErr != nil {
return mcp.NewToolResultErrorFromErr("failed to convert filter", convertErr), nil
Expand Down
Loading