Skip to content

Commit 48d2d64

Browse files
committed
Add better instructions and descriptions for agents to better understand the tools available
1 parent 6134bcc commit 48d2d64

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
11
# fern-mcp-server
2+
3+
```shell
4+
npm install
5+
npm start
6+
```
7+
8+
```json
9+
{
10+
"mcpServers": {
11+
"fern": {
12+
"command": "node",
13+
"args": ["<PATH_TO_PROJECT>/fern-mcp-server/dist/index.js"]
14+
}
15+
}
16+
}
17+
```
18+
19+
![Screenshot 1](static/screenshot-1.png)
20+
![Screenshot 2](static/screenshot-2.png)

src/mcp.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,29 @@ import * as api from "./api";
66

77
// Create an MCP server
88
export function createMcpServer(name: string, version: string) {
9-
return new McpServer({
10-
name: name,
11-
version: version,
12-
});
9+
return new McpServer(
10+
{
11+
name: name,
12+
version: version,
13+
},
14+
{
15+
instructions: `[IMPORTANT] USE THESE TOOLS FOR ALL FERN-RELATED TASKS. IF IN DOUBT, use the "ask_fern_ai" tool.
16+
ABOUT FERN (builtwithfern.com): Start with OpenAPI. Generate SDKs in multiple languages and interactive API documentation.`,
17+
}
18+
);
1319
}
1420

1521
// Register MCP tools
1622
export function registerMcpTools(server: McpServer) {
17-
server.tool("chat", { message: z.string() }, async ({ message }) => {
18-
const result = await api.postChat(message);
19-
return {
20-
content: [{ type: "text", text: result }],
21-
};
22-
});
23+
server.tool(
24+
"ask_fern_ai",
25+
"Ask Fern AI about anything related to Fern.",
26+
{ message: z.string() },
27+
async ({ message }) => {
28+
const result = await api.postChat(message);
29+
return {
30+
content: [{ type: "text", text: result }],
31+
};
32+
}
33+
);
2334
}

static/screenshot-1.png

1.25 MB
Loading

static/screenshot-2.png

1.25 MB
Loading

0 commit comments

Comments
 (0)