Skip to content

Commit 06e24ab

Browse files
update synthesis schema
1 parent bd4edbb commit 06e24ab

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

mp_api/client/routes/materials/synthesis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from emmet.core.synthesis import (
44
OperationTypeEnum,
5-
SynthesisSearchResultModel,
5+
SynthesisRecipe,
66
SynthesisTypeEnum,
77
)
88

@@ -11,7 +11,7 @@
1111

1212
class SynthesisRester(BaseRester):
1313
suffix = "materials/synthesis"
14-
document_model = SynthesisSearchResultModel # type: ignore
14+
document_model = SynthesisRecipe # type: ignore
1515

1616
def search(
1717
self,
@@ -29,7 +29,7 @@ def search(
2929
condition_mixing_media: list[str] | None = None,
3030
num_chunks: int | None = None,
3131
chunk_size: int | None = 10,
32-
) -> list[SynthesisSearchResultModel] | list[dict]:
32+
) -> list[SynthesisRecipe] | list[dict]:
3333
"""Search synthesis recipe text.
3434
3535
Arguments:
@@ -50,7 +50,7 @@ def search(
5050
5151
5252
Returns:
53-
([SynthesisSearchResultModel], [dict]): List of synthesis documents or dictionaries.
53+
([SynthesisRecipe], [dict]): List of synthesis documents or dictionaries.
5454
"""
5555
# Turn None and empty list into None
5656
keywords = keywords or None

mp_api/mcp/server.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
MCP_SERVER_INSTRUCTIONS = """
1818
This MCP server defines search and document retrieval capabilities
19-
for data in the Materials Project.
20-
Use the search tool to find relevant documents based on materials
21-
keywords.
19+
for data in the Materials Project (https://next-gen.materialsproject.org/).
20+
Use the search tool to find relevant documents based on materials keywords.
2221
Then use the fetch tool to retrieve complete materials summary information.
2322
"""
2423

@@ -82,5 +81,5 @@ def _run_mp_mcp_server() -> None:
8281
mcp.run(**parse_server_args())
8382

8483

85-
if __name__ == "__main__":
84+
if __name__ == "__main__": # pragma: no cover
8685
_run_mp_mcp_server()

tests/mcp/test_server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111

1212
from mp_api.client.core.exceptions import MPRestError
13-
from mp_api.mcp.server import get_core_mcp, parse_server_args
13+
from mp_api.mcp.server import get_core_mcp, parse_server_args, MCP_SERVER_INSTRUCTIONS
1414

1515

1616
async def get_mcp_tools():
@@ -35,6 +35,10 @@ def test_mcp_server():
3535
fetch_tool = asyncio.run(get_mcp_tool("fetch"))
3636
assert fetch_tool.parameters["properties"] == {"idx": {"type": "string"}}
3737

38+
mcp_server = get_core_mcp()
39+
assert isinstance(mcp_server, fastmcp.FastMCP)
40+
assert mcp_server.instructions == MCP_SERVER_INSTRUCTIONS
41+
3842

3943
def test_server_cli():
4044
assert parse_server_args(

0 commit comments

Comments
 (0)