chore(roo): add pic-gen mode rules, update mcp.json and new-mcp-server skill
This commit is contained in:
@@ -30,14 +30,23 @@ touch mcp/{name}/src/__init__.py
|
||||
```
|
||||
|
||||
### Step 2 — Write `mcp/{name}/src/server.py`
|
||||
|
||||
**Convention:** All tool parameters **must** use `Annotated[type, Field(description="...")]` for
|
||||
descriptions. Do **not** use docstring `Args:` sections — FastMCP reads `Field` metadata directly
|
||||
to expose parameter descriptions in the MCP schema.
|
||||
|
||||
```python
|
||||
from typing import Annotated
|
||||
from fastmcp import FastMCP
|
||||
from pydantic import Field
|
||||
|
||||
mcp = FastMCP("mcp-{name}")
|
||||
|
||||
@mcp.tool()
|
||||
def {tool_name}(param: str) -> str:
|
||||
"""Tool description."""
|
||||
def {tool_name}(
|
||||
param: Annotated[str, Field(description="What this parameter controls")],
|
||||
) -> str:
|
||||
"""One-line tool description (no Args: section needed)."""
|
||||
# implementation
|
||||
...
|
||||
|
||||
@@ -45,6 +54,8 @@ if __name__ == "__main__":
|
||||
mcp.run()
|
||||
```
|
||||
|
||||
> Optional parameters with defaults: `param: Annotated[int, Field(description="...")] = 10`
|
||||
|
||||
### Step 3 — Write `mcp/{name}/pyproject.toml`
|
||||
```toml
|
||||
[project]
|
||||
|
||||
Reference in New Issue
Block a user