From 2a469edb856ea8c5ccda53dcd52517aaf4e89979 Mon Sep 17 00:00:00 2001 From: Rahul Madan Date: Fri, 5 Sep 2025 03:21:47 +0530 Subject: [PATCH 1/3] updated tool naming as per suggestion --- .../.cursor/rules/project-structure.mdc | 27 +++++++++------- modelcontextprotocol/README.md | 18 +++++------ modelcontextprotocol/server.py | 32 +++++++++---------- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/modelcontextprotocol/.cursor/rules/project-structure.mdc b/modelcontextprotocol/.cursor/rules/project-structure.mdc index 2537a3d..022ea15 100644 --- a/modelcontextprotocol/.cursor/rules/project-structure.mdc +++ b/modelcontextprotocol/.cursor/rules/project-structure.mdc @@ -32,14 +32,17 @@ The main entry point for the MCP server. Registers and exposes tools defined in ```python from mcp.server.fastmcp import FastMCP from tools import ( - search_assets, - get_assets_by_dsl, - traverse_lineage, - update_assets, + create_glossary_category_assets, + create_glossary_assets, + create_glossary_term_assets, UpdatableAttribute, CertificateStatus, UpdatableAsset, ) +from tools.search import search_assets as search_assets_impl +from tools.dsl import get_assets_by_dsl as get_assets_by_dsl_impl +from tools.lineage import traverse_lineage as traverse_lineage_impl +from tools.assets import update_assets as update_assets_impl from pyatlan.model.fields.atlan_fields import AtlanField from typing import Optional, Dict, Any, List, Union, Type from pyatlan.model.assets import Asset @@ -51,35 +54,35 @@ mcp = FastMCP("Atlan MCP", dependencies=["pyatlan"]) # Refer to the actual server.py and tools implementations for details. @mcp.tool() -def search_assets_tool( +def search_assets( conditions: Optional[Union[Dict[str, Any], str]] = None, # ... many other parameters ... ): """Advanced asset search using FluentSearch with flexible conditions.""" - return search_assets(conditions=conditions, ...) + return search_assets_impl(conditions=conditions, ...) @mcp.tool() -def get_assets_by_dsl_tool(dsl_query: Union[str, Dict[str, Any]]): +def get_assets_by_dsl(dsl_query: Union[str, Dict[str, Any]]): """Execute the search with the given DSL query.""" - return get_assets_by_dsl(dsl_query) + return get_assets_by_dsl_impl(dsl_query) @mcp.tool() -def traverse_lineage_tool( +def traverse_lineage( guid: str, direction: str, # UPSTREAM or DOWNSTREAM # ... other parameters ... ): """Traverse asset lineage in specified direction.""" - return traverse_lineage(guid=guid, direction=direction, ...) + return traverse_lineage_impl(guid=guid, direction=direction, ...) @mcp.tool() -def update_assets_tool( +def update_assets( assets: Union[UpdatableAsset, List[UpdatableAsset]], attribute_name: UpdatableAttribute, attribute_values: List[Union[CertificateStatus, str]], ): """Update one or multiple assets with different values for the same attribute.""" - return update_assets(assets=assets, attribute_name=attribute_name, attribute_values=attribute_values) + return update_assets_impl(assets=assets, attribute_name=attribute_name, attribute_values=attribute_values) ``` ### settings.py diff --git a/modelcontextprotocol/README.md b/modelcontextprotocol/README.md index dd80c3c..45e1dd5 100644 --- a/modelcontextprotocol/README.md +++ b/modelcontextprotocol/README.md @@ -173,7 +173,7 @@ You can restrict access to specific tools using the `RESTRICTED_TOOLS` environme "-e", "ATLAN_AGENT_ID=", "-e", - "RESTRICTED_TOOLS=get_assets_by_dsl_tool,update_assets_tool", + "RESTRICTED_TOOLS=get_assets_by_dsl,update_assets", "ghcr.io/atlanhq/atlan-mcp-server:latest" ] } @@ -193,7 +193,7 @@ You can restrict access to specific tools using the `RESTRICTED_TOOLS` environme "ATLAN_API_KEY": "", "ATLAN_BASE_URL": "https://.atlan.com", "ATLAN_AGENT_ID": "", - "RESTRICTED_TOOLS": "get_assets_by_dsl_tool,update_assets_tool" + "RESTRICTED_TOOLS": "get_assets_by_dsl,update_assets" } } } @@ -204,10 +204,10 @@ You can restrict access to specific tools using the `RESTRICTED_TOOLS` environme You can restrict any of the following tools: -- `search_assets_tool` - Asset search functionality -- `get_assets_by_dsl_tool` - DSL query execution -- `traverse_lineage_tool` - Lineage traversal -- `update_assets_tool` - Asset updates (descriptions, certificates) +- `search_assets` - Asset search functionality +- `get_assets_by_dsl` - DSL query execution +- `traverse_lineage` - Lineage traversal +- `update_assets` - Asset updates (descriptions, certificates) - `create_glossaries` - Glossary creation - `create_glossary_categories` - Category creation - `create_glossary_terms` - Term creation @@ -217,19 +217,19 @@ You can restrict any of the following tools: #### Read-Only Access Restrict all write operations: ``` -RESTRICTED_TOOLS=update_assets_tool,create_glossaries,create_glossary_categories,create_glossary_terms +RESTRICTED_TOOLS=update_assets,create_glossaries,create_glossary_categories,create_glossary_terms ``` #### Disable DSL Queries For security or performance reasons: ``` -RESTRICTED_TOOLS=get_assets_by_dsl_tool +RESTRICTED_TOOLS=get_assets_by_dsl ``` #### Minimal Access Allow only basic search: ``` -RESTRICTED_TOOLS=get_assets_by_dsl_tool,update_assets_tool,traverse_lineage_tool,create_glossaries,create_glossary_categories,create_glossary_terms +RESTRICTED_TOOLS=get_assets_by_dsl,update_assets,traverse_lineage,create_glossaries,create_glossary_categories,create_glossary_terms ``` ### How It Works diff --git a/modelcontextprotocol/server.py b/modelcontextprotocol/server.py index e8a29fd..8544b30 100644 --- a/modelcontextprotocol/server.py +++ b/modelcontextprotocol/server.py @@ -4,10 +4,6 @@ from typing import Any, Dict, List from fastmcp import FastMCP from tools import ( - search_assets, - get_assets_by_dsl, - traverse_lineage, - update_assets, create_glossary_category_assets, create_glossary_assets, create_glossary_term_assets, @@ -15,6 +11,10 @@ CertificateStatus, UpdatableAsset, ) +from tools.search import search_assets as search_assets_impl +from tools.dsl import get_assets_by_dsl as get_assets_by_dsl_impl +from tools.lineage import traverse_lineage as traverse_lineage_impl +from tools.assets import update_assets as update_assets_impl from pyatlan.model.lineage import LineageDirection from utils.parameters import ( parse_json_parameter, @@ -40,7 +40,7 @@ @mcp.tool() -def search_assets_tool( +def search_assets( conditions=None, negative_conditions=None, some_conditions=None, @@ -242,7 +242,7 @@ def search_assets_tool( domain_guids = parse_list_parameter(domain_guids) guids = parse_list_parameter(guids) - return search_assets( + return search_assets_impl( conditions, negative_conditions, some_conditions, @@ -266,7 +266,7 @@ def search_assets_tool( @mcp.tool() -def get_assets_by_dsl_tool(dsl_query): +def get_assets_by_dsl(dsl_query): """ Execute the search with the given query dsl_query : Union[str, Dict[str, Any]] (required): @@ -334,11 +334,11 @@ def get_assets_by_dsl_tool(dsl_query): }''' response = get_assets_by_dsl(dsl_query) """ - return get_assets_by_dsl(dsl_query) + return get_assets_by_dsl_impl(dsl_query) @mcp.tool() -def traverse_lineage_tool( +def traverse_lineage( guid, direction, depth=1000000, @@ -374,7 +374,7 @@ def traverse_lineage_tool( Examples: # Get lineage with default attributes - lineage = traverse_lineage_tool( + lineage = traverse_lineage( guid="asset-guid-here", direction="DOWNSTREAM", depth=1000, @@ -391,7 +391,7 @@ def traverse_lineage_tool( # Parse include_attributes parameter if provided parsed_include_attributes = parse_list_parameter(include_attributes) - return traverse_lineage( + return traverse_lineage_impl( guid=guid, direction=direction_enum, depth=int(depth), @@ -402,7 +402,7 @@ def traverse_lineage_tool( @mcp.tool() -def update_assets_tool( +def update_assets( assets, attribute_name, attribute_values, @@ -426,7 +426,7 @@ def update_assets_tool( Examples: # Update certificate status for a single asset - result = update_assets_tool( + result = update_assets( assets={ "guid": "asset-guid-here", "name": "Asset Name", @@ -438,7 +438,7 @@ def update_assets_tool( ) # Update user description for multiple assets - result = update_assets_tool( + result = update_assets( assets=[ { "guid": "asset-guid-1", @@ -460,7 +460,7 @@ def update_assets_tool( ) # Update readme for a single asset with Markdown - result = update_assets_tool( + result = update_assets( assets={ "guid": "asset-guid-here", "name": "Asset Name", @@ -496,7 +496,7 @@ def update_assets_tool( else: updatable_assets = [UpdatableAsset(**asset) for asset in parsed_assets] - return update_assets( + return update_assets_impl( updatable_assets=updatable_assets, attribute_name=attr_enum, attribute_values=parsed_attribute_values, From a602cb3652873ac41fa57b8a23132372cece0aaa Mon Sep 17 00:00:00 2001 From: Rahul Madan Date: Fri, 5 Sep 2025 03:45:05 +0530 Subject: [PATCH 2/3] added _impl to other functions as well. --- .../.cursor/rules/project-structure.mdc | 8 +++++--- modelcontextprotocol/server.py | 14 ++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modelcontextprotocol/.cursor/rules/project-structure.mdc b/modelcontextprotocol/.cursor/rules/project-structure.mdc index 022ea15..a6088b6 100644 --- a/modelcontextprotocol/.cursor/rules/project-structure.mdc +++ b/modelcontextprotocol/.cursor/rules/project-structure.mdc @@ -32,13 +32,15 @@ The main entry point for the MCP server. Registers and exposes tools defined in ```python from mcp.server.fastmcp import FastMCP from tools import ( - create_glossary_category_assets, - create_glossary_assets, - create_glossary_term_assets, UpdatableAttribute, CertificateStatus, UpdatableAsset, ) +from tools.glossary import ( + create_glossary_category_assets as create_glossary_category_assets_impl, + create_glossary_assets as create_glossary_assets_impl, + create_glossary_term_assets as create_glossary_term_assets_impl, +) from tools.search import search_assets as search_assets_impl from tools.dsl import get_assets_by_dsl as get_assets_by_dsl_impl from tools.lineage import traverse_lineage as traverse_lineage_impl diff --git a/modelcontextprotocol/server.py b/modelcontextprotocol/server.py index 8544b30..c784a3a 100644 --- a/modelcontextprotocol/server.py +++ b/modelcontextprotocol/server.py @@ -4,13 +4,15 @@ from typing import Any, Dict, List from fastmcp import FastMCP from tools import ( - create_glossary_category_assets, - create_glossary_assets, - create_glossary_term_assets, UpdatableAttribute, CertificateStatus, UpdatableAsset, ) +from tools.glossary import ( + create_glossary_category_assets as create_glossary_category_assets_impl, + create_glossary_assets as create_glossary_assets_impl, + create_glossary_term_assets as create_glossary_term_assets_impl, +) from tools.search import search_assets as search_assets_impl from tools.dsl import get_assets_by_dsl as get_assets_by_dsl_impl from tools.lineage import traverse_lineage as traverse_lineage_impl @@ -557,7 +559,7 @@ def create_glossaries(glossaries) -> List[Dict[str, Any]]: except json.JSONDecodeError as e: return {"error": f"Invalid JSON format for glossaries parameter: {str(e)}"} - return create_glossary_assets(glossaries) + return create_glossary_assets_impl(glossaries) @mcp.tool() @@ -622,7 +624,7 @@ def create_glossary_terms(terms) -> List[Dict[str, Any]]: except json.JSONDecodeError as e: return {"error": f"Invalid JSON format for terms parameter: {str(e)}"} - return create_glossary_term_assets(terms) + return create_glossary_term_assets_impl(terms) @mcp.tool() @@ -691,7 +693,7 @@ def create_glossary_categories(categories) -> List[Dict[str, Any]]: except json.JSONDecodeError as e: return {"error": f"Invalid JSON format for categories parameter: {str(e)}"} - return create_glossary_category_assets(categories) + return create_glossary_category_assets_impl(categories) def main(): From 78e790f4ac8b7e5956debe809ba5e55403170b14 Mon Sep 17 00:00:00 2001 From: Rahul Madan Date: Fri, 5 Sep 2025 18:03:40 +0530 Subject: [PATCH 3/3] improved import --- .../.cursor/rules/project-structure.mdc | 16 +++++++--------- modelcontextprotocol/server.py | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/modelcontextprotocol/.cursor/rules/project-structure.mdc b/modelcontextprotocol/.cursor/rules/project-structure.mdc index a6088b6..fdf0fd9 100644 --- a/modelcontextprotocol/.cursor/rules/project-structure.mdc +++ b/modelcontextprotocol/.cursor/rules/project-structure.mdc @@ -32,19 +32,17 @@ The main entry point for the MCP server. Registers and exposes tools defined in ```python from mcp.server.fastmcp import FastMCP from tools import ( - UpdatableAttribute, - CertificateStatus, - UpdatableAsset, -) -from tools.glossary import ( + search_assets as search_assets_impl, + get_assets_by_dsl as get_assets_by_dsl_impl, + traverse_lineage as traverse_lineage_impl, + update_assets as update_assets_impl, create_glossary_category_assets as create_glossary_category_assets_impl, create_glossary_assets as create_glossary_assets_impl, create_glossary_term_assets as create_glossary_term_assets_impl, + UpdatableAttribute, + CertificateStatus, + UpdatableAsset, ) -from tools.search import search_assets as search_assets_impl -from tools.dsl import get_assets_by_dsl as get_assets_by_dsl_impl -from tools.lineage import traverse_lineage as traverse_lineage_impl -from tools.assets import update_assets as update_assets_impl from pyatlan.model.fields.atlan_fields import AtlanField from typing import Optional, Dict, Any, List, Union, Type from pyatlan.model.assets import Asset diff --git a/modelcontextprotocol/server.py b/modelcontextprotocol/server.py index c784a3a..74cb61b 100644 --- a/modelcontextprotocol/server.py +++ b/modelcontextprotocol/server.py @@ -4,19 +4,17 @@ from typing import Any, Dict, List from fastmcp import FastMCP from tools import ( - UpdatableAttribute, - CertificateStatus, - UpdatableAsset, -) -from tools.glossary import ( + search_assets as search_assets_impl, + get_assets_by_dsl as get_assets_by_dsl_impl, + traverse_lineage as traverse_lineage_impl, + update_assets as update_assets_impl, create_glossary_category_assets as create_glossary_category_assets_impl, create_glossary_assets as create_glossary_assets_impl, create_glossary_term_assets as create_glossary_term_assets_impl, + UpdatableAttribute, + CertificateStatus, + UpdatableAsset, ) -from tools.search import search_assets as search_assets_impl -from tools.dsl import get_assets_by_dsl as get_assets_by_dsl_impl -from tools.lineage import traverse_lineage as traverse_lineage_impl -from tools.assets import update_assets as update_assets_impl from pyatlan.model.lineage import LineageDirection from utils.parameters import ( parse_json_parameter,