Skip to main content
Glama

get_workspace_by_handle

Retrieve workspace details using account and workspace handles to access specific workflow automation environments in Prefect.

Instructions

Get a workspace by its handle.

Args: account_handle: The account handle workspace_handle: The workspace handle

Returns: Workspace details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_handleYes
workspace_handleYes

Implementation Reference

  • The main handler function for the 'get_workspace_by_handle' MCP tool. It is decorated with @mcp.tool, which registers it. The function retrieves the Prefect workspace using the provided account_handle and workspace_handle via the Prefect client and returns its details as text content.
    @mcp.tool
    async def get_workspace_by_handle(
        account_handle: str,
        workspace_handle: str,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        """
        Get a workspace by its handle.
        
        Args:
            account_handle: The account handle
            workspace_handle: The workspace handle
            
        Returns:
            Workspace details
        """
        try:
            async with get_client() as client:
                workspace = await client.read_workspace_by_handle(
                    account_handle=account_handle,
                    workspace_handle=workspace_handle
                )
                
                return [types.TextContent(type="text", text=str(workspace.dict()))]
        except Exception as e:
            # For local Prefect instances, workspace APIs may not be available
            return [types.TextContent(
                type="text",
                text="Workspaces are only available in Prefect Cloud. This appears to be a local Prefect instance."
            )]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/allen-munsch/mcp-prefect'

If you have feedback or need assistance with the MCP directory API, please join our Discord server