mcp-new 0.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -97
- package/dist/{chunk-QRUHMGU5.js → chunk-BHGUGEHE.js} +746 -22
- package/dist/cli.js +65 -5
- package/dist/index.d.ts +38 -7
- package/dist/index.js +14 -2
- package/package.json +1 -1
- package/templates/go/.env.example +5 -0
- package/templates/go/.gitignore.ejs +30 -0
- package/templates/go/README.md.ejs +151 -0
- package/templates/go/cmd/server/main.go.ejs +101 -0
- package/templates/go/go.mod.ejs +7 -0
- package/templates/go/internal/tools/example.go.ejs +40 -0
- package/templates/python/README.md.ejs +58 -15
- package/templates/rust/.env.example +8 -0
- package/templates/rust/.gitignore.ejs +19 -0
- package/templates/rust/Cargo.toml.ejs +18 -0
- package/templates/rust/README.md.ejs +155 -0
- package/templates/rust/src/main.rs.ejs +46 -0
- package/templates/rust/src/tools.rs.ejs +105 -0
- package/templates/typescript/README.md.ejs +56 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
2
|
|
|
3
|
-
<%= description || 'MCP Server generated
|
|
3
|
+
<%= description || 'MCP Server generated with mcp-generator' %>
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -28,14 +28,12 @@ Or if installed:
|
|
|
28
28
|
<%= name %>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## Configuration
|
|
31
|
+
## Claude Desktop Configuration
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Add the following to your Claude Desktop config file:
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
38
|
-
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
35
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
36
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
39
37
|
|
|
40
38
|
```json
|
|
41
39
|
{
|
|
@@ -43,7 +41,7 @@ Add this to your Claude Desktop config file:
|
|
|
43
41
|
"<%= name %>": {
|
|
44
42
|
"command": "python",
|
|
45
43
|
"args": ["-m", "src.server"],
|
|
46
|
-
"cwd": "
|
|
44
|
+
"cwd": "<%= process.cwd().replace(/\\/g, '/') %>/<%= name %>"
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -52,26 +50,71 @@ Add this to your Claude Desktop config file:
|
|
|
52
50
|
## Available Tools
|
|
53
51
|
|
|
54
52
|
<% if (includeExampleTool) { %>
|
|
55
|
-
### example_tool
|
|
53
|
+
### `example_tool`
|
|
56
54
|
|
|
57
55
|
A sample tool that demonstrates basic MCP tool functionality.
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
| Parameter | Type | Required | Description |
|
|
58
|
+
|-----------|------|----------|-------------|
|
|
59
|
+
| `query` | string | Yes | The query parameter |
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"name": "example_tool",
|
|
65
|
+
"arguments": {
|
|
66
|
+
"query": "hello world"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
61
70
|
|
|
62
71
|
<% } %>
|
|
63
72
|
<% tools.forEach(function(tool) { %>
|
|
64
|
-
###
|
|
73
|
+
### `<%= tool.name %>`
|
|
65
74
|
|
|
66
75
|
<%= tool.description %>
|
|
67
76
|
|
|
68
77
|
<% if (tool.parameters && tool.parameters.length > 0) { %>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
| Parameter | Type | Required | Description |
|
|
79
|
+
|-----------|------|----------|-------------|
|
|
80
|
+
<% tool.parameters.forEach(function(param) { %>| `<%= param.name %>` | <%= param.type %> | <%= param.required ? 'Yes' : 'No' %> | <%= param.description %> |
|
|
72
81
|
<% }); %>
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"name": "<%- tool.name %>",
|
|
87
|
+
"arguments": {
|
|
88
|
+
<% var reqParams = tool.parameters.filter(p => p.required); reqParams.forEach(function(param, index) { var val = param.type === 'string' ? '"value"' : param.type === 'number' ? '0' : param.type === 'boolean' ? 'true' : param.type === 'array' ? '[]' : '{}'; %> "<%- param.name %>": <%- val %><% if (index < reqParams.length - 1) { %>,<% } %>
|
|
89
|
+
<% }); %> }
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
<% } else { %>
|
|
93
|
+
*This tool has no parameters.*
|
|
94
|
+
|
|
95
|
+
**Example:**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"name": "<%= tool.name %>",
|
|
99
|
+
"arguments": {}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
73
102
|
<% } %>
|
|
103
|
+
|
|
74
104
|
<% }); %>
|
|
105
|
+
## Project Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
<%= name %>/
|
|
109
|
+
├── src/
|
|
110
|
+
│ ├── __init__.py
|
|
111
|
+
│ ├── server.py # Main server file
|
|
112
|
+
│ └── tools/
|
|
113
|
+
│ └── __init__.py
|
|
114
|
+
├── pyproject.toml
|
|
115
|
+
├── requirements.txt
|
|
116
|
+
└── README.md
|
|
117
|
+
```
|
|
75
118
|
|
|
76
119
|
## License
|
|
77
120
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "<%= name %>"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
description = "<%= description || 'MCP Server generated by mcp-generator' %>"
|
|
6
|
+
|
|
7
|
+
[dependencies]
|
|
8
|
+
rmcp = { version = "0.1", features = ["server"<% if (transport === 'stdio') { %>, "transport-io"<% } else { %>, "transport-sse-server"<% } %>] }
|
|
9
|
+
tokio = { version = "1", features = ["full"] }
|
|
10
|
+
serde = { version = "1", features = ["derive"] }
|
|
11
|
+
serde_json = "1"
|
|
12
|
+
anyhow = "1"
|
|
13
|
+
tracing = "0.1"
|
|
14
|
+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|
15
|
+
|
|
16
|
+
[[bin]]
|
|
17
|
+
name = "<%= name %>"
|
|
18
|
+
path = "src/main.rs"
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# <%= name %>
|
|
2
|
+
|
|
3
|
+
<%= description || 'MCP Server generated with mcp-generator' %>
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This is an MCP (Model Context Protocol) server built with Rust using the [rmcp](https://github.com/anthropics/rmcp) SDK.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Rust 1.70 or higher
|
|
12
|
+
- Cargo
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Build the project
|
|
18
|
+
cargo build --release
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Running the Server
|
|
22
|
+
|
|
23
|
+
<% if (transport === 'stdio') { %>
|
|
24
|
+
### STDIO Transport
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cargo run --release
|
|
28
|
+
# or
|
|
29
|
+
./target/release/<%= name %>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The server communicates via standard input/output.
|
|
33
|
+
<% } else { %>
|
|
34
|
+
### SSE Transport
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cargo run --release
|
|
38
|
+
# or
|
|
39
|
+
./target/release/<%= name %>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The server will start an HTTP server with SSE endpoint on port 8080.
|
|
43
|
+
<% } %>
|
|
44
|
+
|
|
45
|
+
## Claude Desktop Configuration
|
|
46
|
+
|
|
47
|
+
Add the following to your Claude Desktop config file:
|
|
48
|
+
|
|
49
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
50
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"<%- name %>": {
|
|
56
|
+
"command": "<%- process.cwd().replace(/\\/g, '/') %>/<%- name %>/target/release/<%- name %>"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Available Tools
|
|
63
|
+
|
|
64
|
+
<% if (includeExampleTool) { %>
|
|
65
|
+
### `example_tool`
|
|
66
|
+
|
|
67
|
+
An example tool that echoes the input.
|
|
68
|
+
|
|
69
|
+
| Parameter | Type | Required | Description |
|
|
70
|
+
|-----------|------|----------|-------------|
|
|
71
|
+
| `input` | string | Yes | Input to echo |
|
|
72
|
+
|
|
73
|
+
**Example:**
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"name": "example_tool",
|
|
77
|
+
"arguments": {
|
|
78
|
+
"input": "hello"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
<% } %>
|
|
84
|
+
<% tools.forEach(function(tool) { %>
|
|
85
|
+
### `<%- tool.name %>`
|
|
86
|
+
|
|
87
|
+
<%= tool.description %>
|
|
88
|
+
|
|
89
|
+
<% if (tool.parameters && tool.parameters.length > 0) { %>
|
|
90
|
+
| Parameter | Type | Required | Description |
|
|
91
|
+
|-----------|------|----------|-------------|
|
|
92
|
+
<% tool.parameters.forEach(function(param) { %>| `<%= param.name %>` | <%= param.type %> | <%= param.required ? 'Yes' : 'No' %> | <%= param.description %> |
|
|
93
|
+
<% }); %>
|
|
94
|
+
|
|
95
|
+
**Example:**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"name": "<%- tool.name %>",
|
|
99
|
+
"arguments": {
|
|
100
|
+
<% var reqParams = tool.parameters.filter(p => p.required); reqParams.forEach(function(param, index) { var val = param.type === 'string' ? '"value"' : param.type === 'number' ? '0' : param.type === 'boolean' ? 'true' : param.type === 'array' ? '[]' : '{}'; %> "<%- param.name %>": <%- val %><% if (index < reqParams.length - 1) { %>,<% } %>
|
|
101
|
+
<% }); %> }
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
<% } else { %>
|
|
105
|
+
*This tool has no parameters.*
|
|
106
|
+
|
|
107
|
+
**Example:**
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"name": "<%- tool.name %>",
|
|
111
|
+
"arguments": {}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
<% } %>
|
|
115
|
+
|
|
116
|
+
<% }); %>
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Run in development mode
|
|
121
|
+
cargo run
|
|
122
|
+
|
|
123
|
+
# Run tests
|
|
124
|
+
cargo test
|
|
125
|
+
|
|
126
|
+
# Check for issues
|
|
127
|
+
cargo clippy
|
|
128
|
+
|
|
129
|
+
# Format code
|
|
130
|
+
cargo fmt
|
|
131
|
+
|
|
132
|
+
# Build release
|
|
133
|
+
cargo build --release
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Testing with MCP Inspector
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npx @modelcontextprotocol/inspector ./target/release/<%= name %>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Project Structure
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
<%= name %>/
|
|
146
|
+
├── src/
|
|
147
|
+
│ ├── main.rs # Server entry point
|
|
148
|
+
│ └── tools.rs # Tool implementations
|
|
149
|
+
├── Cargo.toml
|
|
150
|
+
└── README.md
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
use anyhow::Result;
|
|
2
|
+
use rmcp::{
|
|
3
|
+
model::{CallToolResult, Content, Tool, ToolInputSchema},
|
|
4
|
+
server::Server,
|
|
5
|
+
tool,
|
|
6
|
+
};
|
|
7
|
+
use serde_json::{json, Value};
|
|
8
|
+
use std::collections::HashMap;
|
|
9
|
+
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
|
10
|
+
|
|
11
|
+
mod tools;
|
|
12
|
+
|
|
13
|
+
#[tokio::main]
|
|
14
|
+
async fn main() -> Result<()> {
|
|
15
|
+
// Initialize logging
|
|
16
|
+
tracing_subscriber::registry()
|
|
17
|
+
.with(tracing_subscriber::EnvFilter::new(
|
|
18
|
+
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
|
|
19
|
+
))
|
|
20
|
+
.with(tracing_subscriber::fmt::layer().with_writer(std::io::stderr))
|
|
21
|
+
.init();
|
|
22
|
+
|
|
23
|
+
tracing::info!("Starting <%= name %> MCP server");
|
|
24
|
+
|
|
25
|
+
// Create server
|
|
26
|
+
let server = Server::builder()
|
|
27
|
+
.name("<%= name %>")
|
|
28
|
+
.version("1.0.0")
|
|
29
|
+
<% if (includeExampleTool) { %>
|
|
30
|
+
.tool(tools::example_tool())
|
|
31
|
+
<% } %>
|
|
32
|
+
<% tools.forEach(function(tool) { %>
|
|
33
|
+
.tool(tools::<%= tool.name %>_tool())
|
|
34
|
+
<% }); %>
|
|
35
|
+
.build();
|
|
36
|
+
|
|
37
|
+
<% if (transport === 'stdio') { %>
|
|
38
|
+
// Run with STDIO transport
|
|
39
|
+
server.run_stdio().await?;
|
|
40
|
+
<% } else { %>
|
|
41
|
+
// Run with SSE transport
|
|
42
|
+
server.run_sse("0.0.0.0:8080", "/messages").await?;
|
|
43
|
+
<% } %>
|
|
44
|
+
|
|
45
|
+
Ok(())
|
|
46
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
use rmcp::{
|
|
2
|
+
model::{CallToolResult, Content, Tool, ToolInputSchema},
|
|
3
|
+
tool,
|
|
4
|
+
};
|
|
5
|
+
use serde::{Deserialize, Serialize};
|
|
6
|
+
use serde_json::{json, Value};
|
|
7
|
+
use std::collections::HashMap;
|
|
8
|
+
|
|
9
|
+
<% if (includeExampleTool) { %>
|
|
10
|
+
/// Example tool that echoes the input
|
|
11
|
+
#[derive(Debug, Deserialize)]
|
|
12
|
+
pub struct ExampleToolInput {
|
|
13
|
+
pub query: String,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
pub fn example_tool() -> Tool {
|
|
17
|
+
Tool {
|
|
18
|
+
name: "example_tool".to_string(),
|
|
19
|
+
description: Some("An example tool that echoes the input".to_string()),
|
|
20
|
+
input_schema: ToolInputSchema {
|
|
21
|
+
r#type: "object".to_string(),
|
|
22
|
+
properties: Some({
|
|
23
|
+
let mut props = HashMap::new();
|
|
24
|
+
props.insert(
|
|
25
|
+
"query".to_string(),
|
|
26
|
+
json!({
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "The query to echo"
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
props
|
|
32
|
+
}),
|
|
33
|
+
required: Some(vec!["query".to_string()]),
|
|
34
|
+
},
|
|
35
|
+
handler: Box::new(|args| {
|
|
36
|
+
Box::pin(async move {
|
|
37
|
+
let input: ExampleToolInput = serde_json::from_value(args)?;
|
|
38
|
+
Ok(CallToolResult {
|
|
39
|
+
content: vec![Content::Text {
|
|
40
|
+
text: format!("Echo: {}", input.query),
|
|
41
|
+
}],
|
|
42
|
+
is_error: None,
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
<% } %>
|
|
49
|
+
|
|
50
|
+
<% tools.forEach(function(tool) { %>
|
|
51
|
+
/// <%= tool.description %>
|
|
52
|
+
#[derive(Debug, Deserialize)]
|
|
53
|
+
pub struct <%= tool.name.charAt(0).toUpperCase() + tool.name.slice(1).replace(/_([a-z])/g, (_, c) => c.toUpperCase()) %>Input {
|
|
54
|
+
<% tool.parameters.forEach(function(param) { %>
|
|
55
|
+
<% if (param.type === 'number') { %>
|
|
56
|
+
pub <%= param.name %>: f64,
|
|
57
|
+
<% } else if (param.type === 'boolean') { %>
|
|
58
|
+
pub <%= param.name %>: bool,
|
|
59
|
+
<% } else if (param.type === 'array') { %>
|
|
60
|
+
pub <%= param.name %>: Vec<Value>,
|
|
61
|
+
<% } else if (param.type === 'object') { %>
|
|
62
|
+
pub <%= param.name %>: HashMap<String, Value>,
|
|
63
|
+
<% } else { %>
|
|
64
|
+
pub <%= param.name %>: String,
|
|
65
|
+
<% } %>
|
|
66
|
+
<% }); %>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
pub fn <%= tool.name %>_tool() -> Tool {
|
|
70
|
+
Tool {
|
|
71
|
+
name: "<%= tool.name %>".to_string(),
|
|
72
|
+
description: Some("<%= tool.description %>".to_string()),
|
|
73
|
+
input_schema: ToolInputSchema {
|
|
74
|
+
r#type: "object".to_string(),
|
|
75
|
+
properties: Some({
|
|
76
|
+
let mut props = HashMap::new();
|
|
77
|
+
<% tool.parameters.forEach(function(param) { %>
|
|
78
|
+
props.insert(
|
|
79
|
+
"<%= param.name %>".to_string(),
|
|
80
|
+
json!({
|
|
81
|
+
"type": "<%= param.type %>",
|
|
82
|
+
"description": "<%= param.description %>"
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
85
|
+
<% }); %>
|
|
86
|
+
props
|
|
87
|
+
}),
|
|
88
|
+
required: Some(vec![<%= tool.parameters.filter(p => p.required).map(p => '"' + p.name + '".to_string()').join(', ') %>]),
|
|
89
|
+
},
|
|
90
|
+
handler: Box::new(|args| {
|
|
91
|
+
Box::pin(async move {
|
|
92
|
+
// TODO: Implement <%= tool.name %> logic
|
|
93
|
+
let input: <%= tool.name.charAt(0).toUpperCase() + tool.name.slice(1).replace(/_([a-z])/g, (_, c) => c.toUpperCase()) %>Input = serde_json::from_value(args.clone())?;
|
|
94
|
+
|
|
95
|
+
Ok(CallToolResult {
|
|
96
|
+
content: vec![Content::Text {
|
|
97
|
+
text: format!("<%= tool.name %> called with: {:?}", args),
|
|
98
|
+
}],
|
|
99
|
+
is_error: None,
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
<% }); %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
2
|
|
|
3
|
-
<%= description || 'MCP Server generated
|
|
3
|
+
<%= description || 'MCP Server generated with mcp-generator' %>
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -29,21 +29,19 @@ npm run dev
|
|
|
29
29
|
npm run inspector
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## Configuration
|
|
32
|
+
## Claude Desktop Configuration
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Add the following to your Claude Desktop config file:
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
39
|
-
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
36
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
37
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
40
38
|
|
|
41
39
|
```json
|
|
42
40
|
{
|
|
43
41
|
"mcpServers": {
|
|
44
42
|
"<%= name %>": {
|
|
45
43
|
"command": "node",
|
|
46
|
-
"args": ["
|
|
44
|
+
"args": ["<%= process.cwd().replace(/\\/g, '/') %>/<%= name %>/dist/index.js"]
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -52,26 +50,69 @@ Add this to your Claude Desktop config file:
|
|
|
52
50
|
## Available Tools
|
|
53
51
|
|
|
54
52
|
<% if (includeExampleTool) { %>
|
|
55
|
-
### example_tool
|
|
53
|
+
### `example_tool`
|
|
56
54
|
|
|
57
55
|
A sample tool that demonstrates basic MCP tool functionality.
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
| Parameter | Type | Required | Description |
|
|
58
|
+
|-----------|------|----------|-------------|
|
|
59
|
+
| `query` | string | Yes | The query parameter |
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"name": "example_tool",
|
|
65
|
+
"arguments": {
|
|
66
|
+
"query": "hello world"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
61
70
|
|
|
62
71
|
<% } %>
|
|
63
72
|
<% tools.forEach(function(tool) { %>
|
|
64
|
-
###
|
|
73
|
+
### `<%= tool.name %>`
|
|
65
74
|
|
|
66
75
|
<%= tool.description %>
|
|
67
76
|
|
|
68
77
|
<% if (tool.parameters && tool.parameters.length > 0) { %>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
| Parameter | Type | Required | Description |
|
|
79
|
+
|-----------|------|----------|-------------|
|
|
80
|
+
<% tool.parameters.forEach(function(param) { %>| `<%= param.name %>` | <%= param.type %> | <%= param.required ? 'Yes' : 'No' %> | <%= param.description %> |
|
|
72
81
|
<% }); %>
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"name": "<%- tool.name %>",
|
|
87
|
+
"arguments": {
|
|
88
|
+
<% var reqParams = tool.parameters.filter(p => p.required); reqParams.forEach(function(param, index) { var val = param.type === 'string' ? '"value"' : param.type === 'number' ? '0' : param.type === 'boolean' ? 'true' : param.type === 'array' ? '[]' : '{}'; %> "<%- param.name %>": <%- val %><% if (index < reqParams.length - 1) { %>,<% } %>
|
|
89
|
+
<% }); %> }
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
<% } else { %>
|
|
93
|
+
*This tool has no parameters.*
|
|
94
|
+
|
|
95
|
+
**Example:**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"name": "<%= tool.name %>",
|
|
99
|
+
"arguments": {}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
73
102
|
<% } %>
|
|
103
|
+
|
|
74
104
|
<% }); %>
|
|
105
|
+
## Project Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
<%= name %>/
|
|
109
|
+
├── src/
|
|
110
|
+
│ └── index.ts # Main server file
|
|
111
|
+
├── dist/ # Compiled output
|
|
112
|
+
├── package.json
|
|
113
|
+
├── tsconfig.json
|
|
114
|
+
└── README.md
|
|
115
|
+
```
|
|
75
116
|
|
|
76
117
|
## License
|
|
77
118
|
|