Skip to content

Commit ac5dc5c

Browse files
authored
Merge pull request #3 from CHRISCARLON/version-0.1.4
V0.1.4 PR
2 parents 7d7abf3 + 8db0cee commit ac5dc5c

File tree

13 files changed

+1136
-352
lines changed

13 files changed

+1136
-352
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "os-mcp"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "A Python MCP server that provides access to Ordnance Survey's DataHub APIs."
55
readme = "README.md"
66
requires-python = ">=3.11"

src/api_service/os_api.py

Lines changed: 433 additions & 83 deletions
Large diffs are not rendered by default.

src/api_service/protocols.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
from typing import Protocol, Dict, List, Any, Optional, runtime_checkable
2+
from models import (
3+
OpenAPISpecification,
4+
CollectionsCache,
5+
WorkflowContextCache,
6+
CollectionQueryables,
7+
)
28

39

410
@runtime_checkable
@@ -35,10 +41,20 @@ async def make_request_no_auth(
3541
"""Make a request without authentication"""
3642
...
3743

38-
async def cache_openapi_spec(self):
44+
async def cache_openapi_spec(self) -> OpenAPISpecification:
3945
"""Cache the OpenAPI spec"""
4046
...
4147

42-
async def cache_collections(self):
48+
async def cache_collections(self) -> CollectionsCache:
4349
"""Cache the collections data"""
4450
...
51+
52+
async def cache_workflow_context(self) -> WorkflowContextCache:
53+
"""Cache the workflow context data"""
54+
...
55+
56+
async def fetch_collections_queryables(
57+
self, collection_ids: List[str]
58+
) -> Dict[str, CollectionQueryables]:
59+
"""Fetch detailed queryables for specific collections only"""
60+
...

src/mcp_service/os_service.py

Lines changed: 306 additions & 217 deletions
Large diffs are not rendered by default.

src/mcp_service/prompts.py

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,65 +8,69 @@
88

99
class OSWorkflowPrompts:
1010
"""Handles registration of OS NGD workflow prompts"""
11-
11+
1212
def __init__(self, mcp_service):
1313
self.mcp = mcp_service
14-
14+
1515
def register_all(self) -> None:
1616
"""Register all workflow prompts"""
1717
self._register_analysis_prompts()
1818
self._register_general_prompts()
19-
19+
2020
def _register_analysis_prompts(self) -> None:
2121
"""Register analysis workflow prompts"""
22-
22+
2323
@self.mcp.prompt()
2424
def usrn_breakdown_analysis(usrn: str) -> List[PromptMessage]:
2525
"""Generate a step-by-step USRN breakdown workflow"""
2626
template = PROMPT_TEMPLATES["usrn_breakdown"].format(usrn=usrn)
27-
27+
2828
return [
2929
PromptMessage(
3030
role="user",
3131
content=TextContent(
3232
type="text",
33-
text=f"As an expert in OS NGD API workflows and transport network analysis, {template}"
34-
)
33+
text=f"As an expert in OS NGD API workflows and transport network analysis, {template}",
34+
),
3535
)
3636
]
37-
37+
3838
def _register_general_prompts(self) -> None:
3939
"""Register general OS NGD guidance prompts"""
40-
40+
4141
@self.mcp.prompt()
42-
def collection_query_guidance(collection_id: str, query_type: str = "features") -> List[PromptMessage]:
42+
def collection_query_guidance(
43+
collection_id: str, query_type: str = "features"
44+
) -> List[PromptMessage]:
4345
"""Generate guidance for querying OS NGD collections"""
4446
return [
4547
PromptMessage(
4648
role="user",
4749
content=TextContent(
4850
type="text",
4951
text=f"As an OS NGD API expert, guide me through querying the '{collection_id}' collection for {query_type}. "
50-
f"Include: 1) Available filters, 2) Best practices for bbox queries, "
51-
f"3) CRS considerations, 4) Example queries with proper syntax."
52-
)
52+
f"Include: 1) Available filters, 2) Best practices for bbox queries, "
53+
f"3) CRS considerations, 4) Example queries with proper syntax.",
54+
),
5355
)
5456
]
55-
57+
5658
@self.mcp.prompt()
57-
def workflow_planning(user_request: str, data_theme: str = "transport") -> List[PromptMessage]:
59+
def workflow_planning(
60+
user_request: str, data_theme: str = "transport"
61+
) -> List[PromptMessage]:
5862
"""Generate a workflow plan for complex OS NGD queries"""
5963
return [
6064
PromptMessage(
6165
role="user",
6266
content=TextContent(
6367
type="text",
6468
text=f"As a geospatial workflow planner, create a detailed workflow plan for: '{user_request}'. "
65-
f"Focus on {data_theme} theme data. Include: "
66-
f"1) Collection selection rationale, "
67-
f"2) Query sequence with dependencies, "
68-
f"3) Filter strategies, "
69-
f"4) Error handling considerations."
70-
)
69+
f"Focus on {data_theme} theme data. Include: "
70+
f"1) Collection selection rationale, "
71+
f"2) Query sequence with dependencies, "
72+
f"3) Filter strategies, "
73+
f"4) Error handling considerations.",
74+
),
7175
)
72-
]
76+
]

src/mcp_service/protocols.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ async def list_collections(self) -> str:
4242
"""List all available feature collections"""
4343
...
4444

45-
async def get_collection_info(self, collection_id: str) -> str:
45+
async def get_single_collection(self, collection_id: str) -> str:
4646
"""Get detailed information about a specific collection"""
4747
...
4848

49-
async def get_collection_queryables(self, collection_id: str) -> str:
49+
async def get_single_collection_queryables(self, collection_id: str) -> str:
5050
"""Get queryable properties for a collection"""
5151
...
5252

@@ -96,3 +96,7 @@ async def get_bulk_linked_features(
9696
) -> str:
9797
"""Get linked features for multiple identifiers"""
9898
...
99+
100+
async def fetch_detailed_collections(self, collection_ids: List[str]) -> str:
101+
"""Get detailed information about specific collections for workflow planning"""
102+
...

src/mcp_service/resources.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
logger = get_logger(__name__)
99

10-
# TODO: Do this for
10+
11+
# TODO: Do this for
1112
class OSDocumentationResources:
1213
"""Handles registration of OS NGD documentation resources"""
1314

0 commit comments

Comments
 (0)