Skip to content

Commit 81e6133

Browse files
authored
feat: use memory with pipeline tools (#113)
1 parent 6524e9f commit 81e6133

9 files changed

Lines changed: 374 additions & 185 deletions

File tree

src/deepset_mcp/api/pipeline/models.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,26 @@ class DeepsetStreamEvent(BaseModel):
188188
delta: StreamDelta | None = None
189189
result: DeepsetSearchResponse | None = None
190190
error: str | None = None
191+
192+
193+
class PipelineList(BaseModel):
194+
"""Response model for listing pipelines."""
195+
196+
data: list[DeepsetPipeline]
197+
has_more: bool
198+
total: int
199+
200+
201+
class PipelineValidationResultWithYaml(BaseModel):
202+
"""Model for pipeline validation result that includes the original YAML."""
203+
204+
validation_result: PipelineValidationResult
205+
yaml_config: str
206+
207+
208+
class PipelineOperationWithErrors(BaseModel):
209+
"""Model for pipeline operations that complete with validation errors."""
210+
211+
message: str
212+
validation_result: PipelineValidationResult
213+
pipeline: DeepsetPipeline

src/deepset_mcp/api/pipeline/resource.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
DeepsetPipeline,
1010
DeepsetSearchResponse,
1111
DeepsetStreamEvent,
12+
PipelineList,
1213
PipelineLogList,
1314
PipelineValidationResult,
1415
ValidationError,
@@ -73,12 +74,12 @@ async def list(
7374
self,
7475
page_number: int = 1,
7576
limit: int = 10,
76-
) -> list[DeepsetPipeline]:
77+
) -> PipelineList:
7778
"""Retrieve pipeline in the configured workspace with optional pagination.
7879
7980
:param page_number: Page number for paging.
8081
:param limit: Max number of items to return.
81-
:returns: List of DeepsetPipeline instances.
82+
:returns: PipelineList with pipelines and metadata.
8283
"""
8384
params: dict[str, Any] = {
8485
"page_number": page_number,
@@ -97,10 +98,13 @@ async def list(
9798

9899
if response is not None:
99100
pipelines = [DeepsetPipeline.model_validate(item) for item in response.get("data", [])]
101+
return PipelineList(
102+
data=pipelines,
103+
has_more=response.get("has_more", False),
104+
total=response.get("total", len(pipelines)),
105+
)
100106
else:
101-
pipelines = []
102-
103-
return pipelines
107+
return PipelineList(data=[], has_more=False, total=0)
104108

105109
async def get(self, pipeline_name: str, include_yaml: bool = True) -> DeepsetPipeline:
106110
"""Fetch a single pipeline by its name.

src/deepset_mcp/api/protocols.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
DeepsetPipeline,
1111
DeepsetSearchResponse,
1212
DeepsetStreamEvent,
13+
PipelineList,
1314
PipelineLogList,
1415
PipelineValidationResult,
1516
)
@@ -257,7 +258,7 @@ async def list(
257258
self,
258259
page_number: int = 1,
259260
limit: int = 10,
260-
) -> list[DeepsetPipeline]:
261+
) -> PipelineList:
261262
"""List pipelines in the configured workspace with optional pagination."""
262263
...
263264

src/deepset_mcp/tool_factory.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,38 @@ def get_workspace_from_env() -> str:
128128
# Tool registry with configurations
129129
TOOL_REGISTRY = {
130130
# Workspace tools
131-
"list_pipelines": (list_pipelines_tool, ToolConfig(needs_client=True, needs_workspace=True)),
132-
"create_pipeline": (create_pipeline_tool, ToolConfig(needs_client=True, needs_workspace=True)),
133-
"update_pipeline": (update_pipeline_tool, ToolConfig(needs_client=True, needs_workspace=True)),
134-
"get_pipeline": (get_pipeline_tool, ToolConfig(needs_client=True, needs_workspace=True)),
135-
"deploy_pipeline": (deploy_pipeline_tool, ToolConfig(needs_client=True, needs_workspace=True)),
136-
"validate_pipeline": (validate_pipeline_tool, ToolConfig(needs_client=True, needs_workspace=True)),
137-
"get_pipeline_logs": (get_pipeline_logs_tool, ToolConfig(needs_client=True, needs_workspace=True)),
138-
"search_pipeline": (search_pipeline_tool, ToolConfig(needs_client=True, needs_workspace=True)),
131+
"list_pipelines": (
132+
list_pipelines_tool,
133+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.EXPLORABLE),
134+
),
135+
"create_pipeline": (
136+
create_pipeline_tool,
137+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.BOTH),
138+
),
139+
"update_pipeline": (
140+
update_pipeline_tool,
141+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.BOTH),
142+
),
143+
"get_pipeline": (
144+
get_pipeline_tool,
145+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.EXPLORABLE),
146+
),
147+
"deploy_pipeline": (
148+
deploy_pipeline_tool,
149+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.EXPLORABLE),
150+
),
151+
"validate_pipeline": (
152+
validate_pipeline_tool,
153+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.BOTH),
154+
),
155+
"get_pipeline_logs": (
156+
get_pipeline_logs_tool,
157+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.EXPLORABLE),
158+
),
159+
"search_pipeline": (
160+
search_pipeline_tool,
161+
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.EXPLORABLE),
162+
),
139163
"list_indexes": (
140164
list_indexes_tool,
141165
ToolConfig(needs_client=True, needs_workspace=True, memory_type=MemoryType.EXPLORABLE),

0 commit comments

Comments
 (0)