3 Commits
0.4.0 ... 0.5.0

Author SHA1 Message Date
4734005ae4 Bump version from 0.4.0 to 0.5.0 2025-03-19 16:48:15 +00:00
63ff02fa4b Merge pull request #17 from bhavaniravi/bhavani/2-add-tool-description
chore: #2 add description to tools
2025-03-19 21:58:27 +05:30
Bhavani Ravi
407eb00c1b chore: #2 add description to tools 2025-03-19 20:45:51 +05:30
5 changed files with 26 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
[project]
name = "airflow-mcp-server"
version = "0.4.0"
version = "0.5.0"
description = "MCP Server for Airflow"
readme = "README.md"
requires-python = ">=3.11"

View File

@@ -20,6 +20,7 @@ class OperationDetails:
method: str
parameters: dict[str, Any]
input_model: type[BaseModel]
description: str
class OperationParser:
@@ -104,6 +105,7 @@ class OperationParser:
operation["path"] = path
operation["path_item"] = path_item
description = operation.get("description") or operation.get("summary") or operation_id
parameters = self.extract_parameters(operation)
@@ -119,7 +121,7 @@ class OperationParser:
# Create unified input model
input_model = self._create_input_model(operation_id, parameters, body_schema)
return OperationDetails(operation_id=operation_id, path=str(path), method=method, parameters=parameters, input_model=input_model)
return OperationDetails(operation_id=operation_id, path=str(path), method=method, parameters=parameters, description=description, input_model=input_model)
raise ValueError(f"Operation {operation_id} not found in spec")

View File

@@ -1,9 +1,10 @@
from abc import ABC, abstractmethod
from typing import Any
class BaseTools(ABC):
"""Abstract base class for tools."""
@abstractmethod
def __init__(self) -> None:
"""Initialize the tool."""
@@ -12,7 +13,7 @@ class BaseTools(ABC):
@abstractmethod
def run(self) -> Any:
"""Execute the tool's main functionality.
Returns:
Any: The result of the tool execution
"""

View File

@@ -105,7 +105,7 @@ async def get_airflow_tools(config: AirflowConfig, mode: str = "unsafe") -> list
tools.append(
Tool(
name=operation_id,
description=tool.operation.operation_id,
description=tool.operation.description,
inputSchema=schema,
)
)

View File

@@ -31,6 +31,24 @@ def test_parse_operation_basic(parser: OperationParser) -> None:
assert operation.operation_id == "get_dags"
assert operation.path == "/dags"
assert operation.method == "get"
assert (
operation.description
== """List DAGs in the database.
`dag_id_pattern` can be set to match dags of a specific pattern
"""
)
assert isinstance(operation.parameters, dict)
def test_parse_operation_with_no_description_but_summary(parser: OperationParser) -> None:
"""Test parsing operation with no description but summary."""
operation = parser.parse_operation("get_connections")
assert isinstance(operation, OperationDetails)
assert operation.operation_id == "get_connections"
assert operation.path == "/connections"
assert operation.method == "get"
assert operation.description == "List connections"
assert isinstance(operation.parameters, dict)