get_entity_annotations
Retrieve annotations for Synapse entities such as datasets, projects, folders, files, and tables to access metadata and descriptive information programmatically.
Instructions
Get annotations for an entity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/synapse_mcp/tools.py:58-80 (handler)MCP tool handler for 'get_entity_annotations'. Validates ID, fetches annotations via BaseEntityOperations, formats them, and handles errors.
@mcp.tool( title="Fetch Entity Annotations", description="Return custom annotation key/value pairs for a Synapse entity.", annotations={ "readOnlyHint": True, "idempotentHint": True, "destructiveHint": False, "openWorldHint": True, }, ) def get_entity_annotations(entity_id: str, ctx: Context) -> Dict[str, Any]: """Return custom annotation key/value pairs for a Synapse entity.""" if not validate_synapse_id(entity_id): return {"error": f"Invalid Synapse ID: {entity_id}"} try: entity_ops = get_entity_operations(ctx) annotations = entity_ops["base"].get_entity_annotations(entity_id) return format_annotations(annotations) except ConnectionAuthError as exc: return {"error": f"Authentication required: {exc}", "entity_id": entity_id} except Exception as exc: # pragma: no cover - defensive path return {"error": str(exc), "entity_id": entity_id} - Core helper method in BaseEntityOperations class that calls synapse_client.get_annotations(entity_id) to retrieve raw annotations.
def get_entity_annotations(self, entity_id: str) -> Dict[str, Any]: """Get annotations for an entity. Args: entity_id: The Synapse ID of the entity Returns: The entity annotations as a dictionary """ # Get annotations using the get_annotations method annotations = self.synapse_client.get_annotations(entity_id) # Ensure we return a dictionary if annotations is None: return {} return annotations