get_block_types
Retrieve available block types from Prefect workflows with filtering options to find specific components for workflow automation.
Instructions
Get a list of block types with optional filtering.
Args: limit: Maximum number of block types to return offset: Number of block types to skip slug: Filter by slug pattern
Returns: A list of block types with their details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No | ||
| slug | No |
Implementation Reference
- src/mcp_prefect/block.py:10-45 (handler)The handler function implementing the 'get_block_types' MCP tool. It uses the Prefect client to fetch block types with optional filters and returns the result as text content.@mcp.tool async def get_block_types( limit: Optional[int] = None, offset: Optional[int] = None, slug: Optional[str] = None, ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: """ Get a list of block types with optional filtering. Args: limit: Maximum number of block types to return offset: Number of block types to skip slug: Filter by slug pattern Returns: A list of block types with their details """ async with get_client() as client: # Build filter parameters filters = {} if slug: filters["slug"] = {"like_": f"%{slug}%"} block_types = await client.read_block_types( # # limit=limit, # offset=offset, # **filters ) block_types_result = { "block_types": [block_type.model_dump() for block_type in block_types] } return [types.TextContent(type="text", text=str(block_types_result))]