Compare commits
3 Commits
707f3747d7
...
0.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
4734005ae4
|
|||
| 63ff02fa4b | |||
|
|
407eb00c1b |
@@ -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"
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
|
||||
|
||||
class BaseTools(ABC):
|
||||
"""Abstract base class for tools."""
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user