Skip to content

Commit 4e0db81

Browse files
authored
Disable docs sample search (#133)
* bump version * make format async * turn off initialize docs/samples * update type hint * make format async * remove docs and samples tools * change to floating point numbers for type checking * remove tests * make not async * remove tests
1 parent b688da9 commit 4e0db81

File tree

10 files changed

+67
-657
lines changed

10 files changed

+67
-657
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "uv_build"
44

55
[project]
66
name = "zoo_mcp"
7-
version = "0.12.1"
7+
version = "0.12.2"
88
requires-python = ">=3.11, <3.14"
99
dependencies = [
1010
"aiofiles<26.0",

server.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"url": "https://github.com/KittyCAD/zoo-mcp",
77
"source": "github"
88
},
9-
"version": "0.12.1",
9+
"version": "0.12.2",
1010
"packages": [
1111
{
1212
"registryType": "pypi",
1313
"identifier": "zoo_mcp",
14-
"version": "0.12.1",
14+
"version": "0.12.2",
1515
"transport": {
1616
"type": "stdio"
1717
},

src/zoo_mcp/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ def _initialize_kcl_samples() -> None:
7373

7474

7575
# Initialize caches when module is imported
76-
_initialize_kcl_docs()
77-
_initialize_kcl_samples()
76+
# _initialize_kcl_docs()
77+
# _initialize_kcl_samples()

src/zoo_mcp/ai_tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import time
33
from pathlib import Path
44

5+
from kittycad._io_types import SyncUpload
56
from kittycad.models import (
67
ApiCallStatus,
78
FileExportFormat,
@@ -216,7 +217,7 @@ async def edit_kcl_project(
216217
"No main.kcl file found in the root of the provided project path"
217218
)
218219

219-
file_attachments = {
220+
file_attachments: dict[str, SyncUpload] = {
220221
str(fp.relative_to(proj_path)): str(fp.resolve()) for fp in file_paths
221222
}
222223

src/zoo_mcp/server.py

Lines changed: 1 addition & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66
from zoo_mcp import ZooMCPException, logger
77
from zoo_mcp.ai_tools import edit_kcl_project as _edit_kcl_project
88
from zoo_mcp.ai_tools import text_to_cad as _text_to_cad
9-
from zoo_mcp.kcl_docs import (
10-
get_doc_content,
11-
list_available_docs,
12-
search_docs,
13-
)
14-
from zoo_mcp.kcl_samples import (
15-
SampleData,
16-
get_sample_content,
17-
list_available_samples,
18-
search_samples,
19-
)
209
from zoo_mcp.utils.image_utils import encode_image, save_image_to_disk
2110
from zoo_mcp.zoo_tools import (
2211
CameraView,
@@ -377,7 +366,7 @@ async def export_kcl(
377366

378367

379368
@mcp.tool()
380-
async def format_kcl(
369+
def format_kcl(
381370
kcl_code: str | None = None,
382371
kcl_path: str | None = None,
383372
) -> str:
@@ -800,173 +789,6 @@ async def save_image(
800789
return f"There was an error saving the image: {e}"
801790

802791

803-
@mcp.tool()
804-
async def list_kcl_docs() -> dict | str:
805-
"""List all available KCL documentation topics organized by category.
806-
807-
Returns a dictionary with the following categories:
808-
- kcl-lang: KCL language documentation (syntax, types, functions, etc.)
809-
- kcl-std-functions: Standard library function documentation
810-
- kcl-std-types: Standard library type documentation
811-
- kcl-std-consts: Standard library constants documentation
812-
- kcl-std-modules: Standard library module documentation
813-
814-
Each category contains a list of documentation file paths that can be
815-
retrieved using get_kcl_doc().
816-
817-
Returns:
818-
dict | str: Categories mapped to lists of available documentation paths.
819-
If there was an error, returns an error message string.
820-
"""
821-
logger.info("list_kcl_docs tool called")
822-
try:
823-
return list_available_docs()
824-
except Exception as e:
825-
logger.error("list_kcl_docs tool called with error: %s", e)
826-
return f"There was an error listing KCL documentation: {e}"
827-
828-
829-
@mcp.tool()
830-
async def search_kcl_docs(query: str, max_results: int = 5) -> list[dict] | str:
831-
"""Search KCL documentation by keyword.
832-
833-
Searches across all KCL language and standard library documentation
834-
for the given query. Returns relevant excerpts with surrounding context.
835-
836-
Args:
837-
query (str): The search query (case-insensitive).
838-
max_results (int): Maximum number of results to return (default: 5).
839-
840-
Returns:
841-
list[dict] | str: List of search results, each containing:
842-
- path: The documentation file path
843-
- title: The document title (from first heading)
844-
- excerpt: A relevant excerpt with the match highlighted in context
845-
- match_count: Number of times the query appears in the document
846-
If there was an error, returns an error message string.
847-
"""
848-
logger.info("search_kcl_docs tool called with query: %s", query)
849-
try:
850-
return search_docs(query, max_results)
851-
except Exception as e:
852-
logger.error("search_kcl_docs tool called with error: %s", e)
853-
return f"There was an error searching KCL documentation: {e}"
854-
855-
856-
@mcp.tool()
857-
async def get_kcl_doc(doc_path: str) -> str:
858-
"""Get the full content of a specific KCL documentation file.
859-
860-
Use list_kcl_docs() to see available documentation paths, or
861-
search_kcl_docs() to find relevant documentation by keyword.
862-
863-
Args:
864-
doc_path (str): The path to the documentation file
865-
(e.g., "docs/kcl-lang/functions.md" or "docs/kcl-std/functions/extrude.md")
866-
867-
Returns:
868-
str: The full Markdown content of the documentation file,
869-
or an error message if not found. If there was an error, returns an error message string.
870-
"""
871-
logger.info("get_kcl_doc tool called for path: %s", doc_path)
872-
try:
873-
content = get_doc_content(doc_path)
874-
if content is None:
875-
return f"Documentation not found: {doc_path}. Use list_kcl_docs() to see available paths."
876-
return content
877-
except Exception as e:
878-
logger.error("get_kcl_doc tool called with error: %s", e)
879-
return f"There was an error retrieving KCL documentation: {e}"
880-
881-
882-
@mcp.tool()
883-
async def list_kcl_samples() -> list[dict] | str:
884-
"""List all available KCL sample projects.
885-
886-
Returns a list of all available KCL code samples from the Zoo samples
887-
repository. Each sample demonstrates a specific CAD modeling technique
888-
or creates a particular 3D model.
889-
890-
Returns:
891-
list[dict] | str: List of sample information, each containing:
892-
- name: The sample directory name (use with get_kcl_sample)
893-
- title: Human-readable title
894-
- description: Brief description of what the sample creates
895-
- multipleFiles: Whether the sample contains multiple KCL files
896-
If there was an error, returns an error message string.
897-
"""
898-
logger.info("list_kcl_samples tool called")
899-
try:
900-
return list_available_samples()
901-
except Exception as e:
902-
logger.error("list_kcl_samples tool called with error: %s", e)
903-
return f"There was an error listing KCL samples: {e}"
904-
905-
906-
@mcp.tool()
907-
async def search_kcl_samples(query: str, max_results: int = 5) -> list[dict] | str:
908-
"""Search KCL samples by keyword.
909-
910-
Searches across all KCL sample titles and descriptions
911-
for the given query. Returns matching samples ranked by relevance.
912-
913-
Args:
914-
query (str): The search query (case-insensitive).
915-
max_results (int): Maximum number of results to return (default: 5).
916-
917-
Returns:
918-
list[dict] | str: List of search results, each containing:
919-
- name: The sample directory name (use with get_kcl_sample)
920-
- title: Human-readable title
921-
- description: Brief description of the sample
922-
- multipleFiles: Whether the sample contains multiple KCL files
923-
- match_count: Number of times the query appears in title/description
924-
- excerpt: A relevant excerpt with the match in context
925-
If there was an error, returns an error message string.
926-
"""
927-
logger.info("search_kcl_samples tool called with query: %s", query)
928-
try:
929-
return search_samples(query, max_results)
930-
except Exception as e:
931-
logger.error("search_kcl_samples tool called with error: %s", e)
932-
return f"There was an error searching KCL samples: {e}"
933-
934-
935-
@mcp.tool()
936-
async def get_kcl_sample(sample_name: str) -> SampleData | str:
937-
"""Get the full content of a specific KCL sample including all files.
938-
939-
Retrieves all KCL files that make up a sample project. Some samples
940-
consist of a single main.kcl file, while others have multiple files
941-
(e.g., parameters.kcl, components, etc.).
942-
943-
Use list_kcl_samples() to see available sample names, or
944-
search_kcl_samples() to find samples by keyword.
945-
946-
Args:
947-
sample_name (str): The sample directory name
948-
(e.g., "ball-bearing", "axial-fan", "gear")
949-
950-
Returns:
951-
SampleData | str: A SampleData dictionary containing:
952-
- name: The sample directory name
953-
- title: Human-readable title
954-
- description: Brief description
955-
- multipleFiles: Whether the sample contains multiple files
956-
- files: List of SampleFile dictionaries, each with 'filename' and 'content'
957-
Returns an error message string if the sample is not found. If there was an error, returns an error message string.
958-
"""
959-
logger.info("get_kcl_sample tool called for sample: %s", sample_name)
960-
try:
961-
sample = await get_sample_content(sample_name)
962-
if sample is None:
963-
return f"Sample not found: {sample_name}. Use list_kcl_samples() to see available samples."
964-
return sample
965-
except Exception as e:
966-
logger.error("get_kcl_sample tool called with error: %s", e)
967-
return f"There was an error retrieving KCL sample: {e}"
968-
969-
970792
def main():
971793
logger.info("Starting MCP server...")
972794
mcp.run(transport="stdio")

src/zoo_mcp/zoo_tools.py

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -211,32 +211,60 @@ class KCLExportFormat(Enum):
211211

212212
class CameraView(Enum):
213213
views = {
214-
"front": {"up": [0, 0, 1], "vantage": [0, -1, 0], "center": [0, 0, 0]},
215-
"back": {"up": [0, 0, 1], "vantage": [0, 1, 0], "center": [0, 0, 0]},
216-
"left": {"up": [0, 0, 1], "vantage": [-1, 0, 0], "center": [0, 0, 0]},
217-
"right": {"up": [0, 0, 1], "vantage": [1, 0, 0], "center": [0, 0, 0]},
218-
"top": {"up": [0, 1, 0], "vantage": [0, 0, 1], "center": [0, 0, 0]},
219-
"bottom": {"up": [0, -1, 0], "vantage": [0, 0, -1], "center": [0, 0, 0]},
220-
"isometric": {"up": [0, 0, 1], "vantage": [1, -1, 1], "center": [0, 0, 0]},
214+
"front": {
215+
"up": [0.0, 0.0, 1.0],
216+
"vantage": [0.0, -1.0, 0.0],
217+
"center": [0.0, 0.0, 0.0],
218+
},
219+
"back": {
220+
"up": [0.0, 0.0, 1.0],
221+
"vantage": [0.0, 1.0, 0.0],
222+
"center": [0.0, 0.0, 0.0],
223+
},
224+
"left": {
225+
"up": [0.0, 0.0, 1.0],
226+
"vantage": [-1.0, 0.0, 0.0],
227+
"center": [0.0, 0.0, 0.0],
228+
},
229+
"right": {
230+
"up": [0.0, 0.0, 1.0],
231+
"vantage": [1.0, 0.0, 0.0],
232+
"center": [0.0, 0.0, 0.0],
233+
},
234+
"top": {
235+
"up": [0.0, 1.0, 0.0],
236+
"vantage": [0.0, 0.0, 1.0],
237+
"center": [0.0, 0.0, 0.0],
238+
},
239+
"bottom": {
240+
"up": [0.0, -1.0, 0.0],
241+
"vantage": [0.0, 0.0, -1.0],
242+
"center": [0.0, 0.0, 0.0],
243+
},
244+
"isometric": {
245+
"up": [0.0, 0.0, 1.0],
246+
"vantage": [1.0, -1.0, 1.0],
247+
"center": [0.0, 0.0, 0.0],
248+
},
221249
"isometric_front_right": {
222-
"up": [0, 0, 1],
223-
"vantage": [1, -1, 1],
224-
"center": [0, 0, 0],
250+
"up": [0.0, 0.0, 1.0],
251+
"vantage": [1.0, -1.0, 1.0],
252+
"center": [0.0, 0.0, 0.0],
225253
},
226254
"isometric_front_left": {
227-
"up": [0, 0, 1],
228-
"vantage": [-1, -1, 1],
229-
"center": [0, 0, 0],
255+
"up": [0.0, 0.0, 1.0],
256+
"vantage": [-1.0, -1.0, 1.0],
257+
"center": [0.0, 0.0, 0.0],
230258
},
231259
"isometric_back_right": {
232-
"up": [0, 0, 1],
233-
"vantage": [1, 1, -1],
234-
"center": [0, 0, 0],
260+
"up": [0.0, 0.0, 1.0],
261+
"vantage": [1.0, 1.0, -1.0],
262+
"center": [0.0, 0.0, 0.0],
235263
},
236264
"isometric_back_left": {
237-
"up": [0, 0, 1],
238-
"vantage": [-1, 1, -1],
239-
"center": [0, 0, 0],
265+
"up": [0.0, 0.0, 1.0],
266+
"vantage": [-1.0, 1.0, -1.0],
267+
"center": [0.0, 0.0, 0.0],
240268
},
241269
}
242270

@@ -261,7 +289,9 @@ def to_kcl_camera(view: dict[str, list[float]]) -> kcl.CameraLookAt:
261289
)
262290

263291
@staticmethod
264-
def to_kittycad_camera(view: dict[str, list[float]]) -> OptionDefaultCameraLookAt:
292+
def to_kittycad_camera(
293+
view: dict[str, list[float]],
294+
) -> OptionDefaultCameraLookAt:
265295
return OptionDefaultCameraLookAt(
266296
up=Point3d(
267297
x=view["up"][0],
@@ -1038,7 +1068,13 @@ def zoo_format_kcl(
10381068
formatted_code = kcl.format(kcl_code)
10391069
return formatted_code
10401070
else:
1041-
kcl.format_dir(str(kcl_path))
1071+
path = Path(kcl_path) # type: ignore[arg-type]
1072+
if path.is_file():
1073+
code = path.read_text()
1074+
formatted = kcl.format(code)
1075+
path.write_text(formatted)
1076+
else:
1077+
kcl.format_dir(str(kcl_path)) # type: ignore[unused-awaitable]
10421078
return None
10431079
except Exception as e:
10441080
logger.error(e)

tests/test_docs.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)