1212from core .database import ImplRepository , LibraryRepository , SpecRepository , get_db_context , is_db_configured
1313
1414
15+ # Website URL for linking to pyplots.ai
16+ PYPLOTS_WEBSITE_URL = "https://pyplots.ai"
17+
1518# Initialize FastMCP server
1619mcp_server = FastMCP ("pyplots" )
1720
@@ -45,7 +48,7 @@ async def list_specs(limit: int = 100, offset: int = 0) -> list[dict[str, Any]]:
4548 item = SpecListItem (
4649 id = spec .id , title = spec .title , description = spec .description , tags = spec .tags , library_count = impl_count
4750 )
48- result .append (item .model_dump ())
51+ result .append ({ ** item .model_dump (), "website_url" : f" { PYPLOTS_WEBSITE_URL } / { spec . id } " } )
4952
5053 return result
5154
@@ -168,7 +171,7 @@ async def search_specs_by_tags(
168171 item = SpecListItem (
169172 id = spec .id , title = spec .title , description = spec .description , tags = spec .tags , library_count = impl_count
170173 )
171- result .append (item .model_dump ())
174+ result .append ({ ** item .model_dump (), "website_url" : f" { PYPLOTS_WEBSITE_URL } / { spec . id } " } )
172175
173176 return result
174177
@@ -226,7 +229,9 @@ async def get_spec_detail(spec_id: str) -> dict[str, Any]:
226229 review_verdict = impl .review_verdict ,
227230 impl_tags = impl .impl_tags ,
228231 )
229- implementations .append (impl_response )
232+ implementations .append (
233+ {** impl_response .model_dump (), "website_url" : f"{ PYPLOTS_WEBSITE_URL } /{ spec_id } /{ impl .library .id } " }
234+ )
230235
231236 # Build full spec response
232237 response = SpecDetailResponse (
@@ -244,7 +249,7 @@ async def get_spec_detail(spec_id: str) -> dict[str, Any]:
244249 implementations = implementations ,
245250 )
246251
247- return response .model_dump ()
252+ return { ** response .model_dump (), "website_url" : f" { PYPLOTS_WEBSITE_URL } / { spec_id } " }
248253
249254
250255@mcp_server .tool ()
@@ -314,7 +319,7 @@ async def get_implementation(spec_id: str, library: str) -> dict[str, Any]:
314319 impl_tags = impl .impl_tags ,
315320 )
316321
317- return response .model_dump ()
322+ return { ** response .model_dump (), "website_url" : f" { PYPLOTS_WEBSITE_URL } / { spec_id } / { library } " }
318323
319324
320325@mcp_server .tool ()
0 commit comments