Skip to content

API Reference parrot_tools.backstage.toolkit

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.backstage.toolkit

View source

BackstageCatalogToolkit — Read entries from a Backstage.io software catalog.

Extends OpenAPIToolkit to auto-generate tools from the official Backstage Catalog Backend OpenAPI spec, and adds curated convenience methods for the most frequent catalog operations.

Class BackstageCatalogToolkit

Toolkit for reading entries from a Backstage.io software catalog.

Provides tools for querying the Backstage Catalog Backend API:

  • List and search entities with filtering and pagination
  • Look up entities by UID, name, or entity refs
  • Query entity facets for aggregated counts
  • List and look up catalog locations
  • Retrieve entity ancestry/lineage
  • Validate entity definitions

Authentication is via Bearer token (Backstage service-to-service or user tokens).

Parameter Type Default Description
base_url Optional[str] None Base URL of the Backstage catalog API (e.g. https://backstage.example.com/api/catalog). Falls back to BACKSTAGE_BASE_URL env var.
api_key Optional[str] None Bearer token for Backstage API authentication. Falls back to BACKSTAGE_API_KEY env var.
timeout int 30 HTTP request timeout in seconds.
use_proxy bool False Whether to route requests through a proxy.
debug bool False Enable debug logging.
**kwargs {} Additional arguments passed to AbstractToolkit.

Attributes:

Attribute Type Description
exclude_tools tuple[str, ...]

Method BackstageCatalogToolkit.list_entities

List all entities in the Backstage catalog with optional filtering.

Use the filter parameter to narrow results. Multiple filters can be combined with comma separation.

list_entities(filter: Optional[str] = None, fields: Optional[str] = None, order: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[str] = None) -> dict[str, Any]

Parameter Type Default Description
filter Optional[str] None Filter expression (e.g. kind=component,metadata.namespace=default or kind=api,spec.type=openapi).
fields Optional[str] None Comma-separated list of fields to include in the response (e.g. metadata.name,metadata.namespace,kind).
order Optional[str] None Ordering specification (e.g. asc:metadata.name).
limit Optional[int] None Maximum number of entities to return.
offset Optional[int] None Number of entities to skip (for pagination).
after Optional[str] None Cursor for keyset pagination.

Returns: dict[str, Any] — List of catalog entities matching the filter criteria.

Method BackstageCatalogToolkit.get_entity_by_uid

Fetch a single entity by its unique identifier (UID).

get_entity_by_uid(uid: str) -> dict[str, Any]

Parameter Type Default Description
uid str The unique identifier of the entity.

Returns: dict[str, Any] — The entity object matching the UID.

Method BackstageCatalogToolkit.get_entity_by_name

Fetch a single entity by kind, namespace, and name.

get_entity_by_name(kind: str, namespace: str, name: str) -> dict[str, Any]

Parameter Type Default Description
kind str Entity kind (e.g. Component, API, System, Group).
namespace str Entity namespace (usually default).
name str Entity name.

Returns: dict[str, Any] — The matching entity object.

Method BackstageCatalogToolkit.get_entity_ancestry

Get the ancestry (lineage) of an entity.

Returns the chain of parent entity references that led to this entity being ingested into the catalog.

get_entity_ancestry(kind: str, namespace: str, name: str) -> dict[str, Any]

Parameter Type Default Description
kind str Entity kind.
namespace str Entity namespace.
name str Entity name.

Returns: dict[str, Any] — Ancestry response with rootEntityRef and items array containing parentEntityRefs at each level.

Method BackstageCatalogToolkit.get_entities_by_refs

Batch-retrieve multiple entities by their entity references.

get_entities_by_refs(entity_refs: list[str], fields: Optional[list[str]] = None) -> dict[str, Any]

Parameter Type Default Description
entity_refs list[str] List of entity references (e.g. ["component:default/my-service", "api:default/my-api"]).
fields Optional[list[str]] None Optional list of fields to include in the response.

Returns: dict[str, Any] — Batch response with an items array (nullable entries for refs that were not found).

Method BackstageCatalogToolkit.query_entities

Search entities with filtering, full-text search, and pagination.

This endpoint supports cursor-based pagination for efficient traversal of large result sets.

query_entities(filter: Optional[str] = None, fields: Optional[str] = None, order_field: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, cursor: Optional[str] = None, full_text_filter_term: Optional[str] = None, full_text_filter_fields: Optional[str] = None) -> dict[str, Any]

Parameter Type Default Description
filter Optional[str] None Filter expression (same syntax as list_entities).
fields Optional[str] None Comma-separated fields to include.
order_field Optional[str] None Field to order results by (e.g. metadata.name).
limit Optional[int] None Maximum number of results per page.
offset Optional[int] None Number of results to skip.
cursor Optional[str] None Pagination cursor from a previous response.
full_text_filter_term Optional[str] None Full-text search term to match against entity fields.
full_text_filter_fields Optional[str] None Comma-separated list of fields to search (e.g. metadata.name,metadata.description).

Returns: dict[str, Any] — Paginated response with items, totalItems, and pageInfo (containing nextCursor / prevCursor).

Method BackstageCatalogToolkit.get_entity_facets

Get faceted (aggregated) counts for entity properties.

Useful for building filter UIs or understanding the distribution of entities across categories.

get_entity_facets(facets: list[str], filter: Optional[str] = None) -> dict[str, Any]

Parameter Type Default Description
facets list[str] List of fields to facet on (e.g. ["kind", "spec.type", "spec.lifecycle"]).
filter Optional[str] None Optional filter to restrict which entities are included.

Returns: dict[str, Any] — Facets response with counts for each unique value of each requested facet field.

Method BackstageCatalogToolkit.list_locations

List all registered catalog locations.

Locations are pointers to catalog descriptor files (e.g. catalog-info.yaml) that Backstage discovers and ingests entities from.

list_locations() -> dict[str, Any]

Returns: dict[str, Any] — Array of location objects (each wrapped in a data property with id, type, and target fields).

Method BackstageCatalogToolkit.get_location_by_id

Fetch a specific catalog location by its ID.

get_location_by_id(location_id: str) -> dict[str, Any]

Parameter Type Default Description
location_id str The unique identifier of the location.

Returns: dict[str, Any] — Location object with id, type, and target.

Method BackstageCatalogToolkit.get_location_by_entity

Get the catalog location that provides a specific entity.

get_location_by_entity(kind: str, namespace: str, name: str) -> dict[str, Any]

Parameter Type Default Description
kind str Entity kind.
namespace str Entity namespace.
name str Entity name.

Returns: dict[str, Any] — The location object that registered the entity.

Method BackstageCatalogToolkit.refresh_entity

Trigger a refresh of a specific entity in the catalog.

Forces Backstage to re-read the entity's source location and update the catalog entry.

refresh_entity(entity_ref: str) -> dict[str, Any]

Parameter Type Default Description
entity_ref str Full entity reference string (e.g. component:default/my-service).

Returns: dict[str, Any] — Success confirmation or error details.

Method BackstageCatalogToolkit.validate_entity

Validate an entity definition against the catalog schema.

Checks whether the provided entity YAML/JSON would be accepted by the catalog without actually registering it.

validate_entity(entity: dict[str, Any], location: str) -> dict[str, Any]

Parameter Type Default Description
entity dict[str, Any] The entity object to validate (as a dict with apiVersion, kind, metadata, spec).
location str Reference location string for the entity.

Returns: dict[str, Any] — Validation result — either success or list of validation errors.

Alias EntitiesQueryResponse

Re-exported from parrot_tools.backstage.models.EntitiesQueryResponse.

Alias Entity

Re-exported from parrot_tools.backstage.models.Entity.

Alias EntityFacetsResponse

Re-exported from parrot_tools.backstage.models.EntityFacetsResponse.

Alias Location

Re-exported from parrot_tools.backstage.models.Location.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally