Skip to content

Commit e6ab7be

Browse files
committed
Add MCP prompt for test writing guidance
Implement 'write tests' prompt that provides LLMs with contextual guidance for writing Java unit tests. The prompt establishes the assistant's role as a skilled test writer, improving the quality of test generation suggestions. This prompt can be invoked by LLM clients to get specialized instructions before using the create tool.
1 parent 5884844 commit e6ab7be

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

covermcp/server.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@
7373
mcp: Annotated[FastMCP[Any], "The global MCP server"] = FastMCP("DiffblueCover")
7474

7575

76+
@mcp.prompt("write tests")
77+
def write_tests() -> list[dict]:
78+
"""Provide system prompt for Java unit test writing guidance.
79+
80+
Establishes LLM context as a Java unit testing expert to improve
81+
test generation quality and suggestions.
82+
83+
Returns:
84+
list[dict]: System role message defining the assistant's expertise.
85+
"""
86+
return [
87+
{
88+
"role": "system",
89+
"content": "You are a helpful assistant highly skilled at writing unit tests for java code.",
90+
},
91+
]
92+
93+
7694
@mcp.tool()
7795
# Ignore "too many parameters for a method" check
7896
async def create( # noqa: PLR0913

0 commit comments

Comments
 (0)