Skip to content

Commit 28620f9

Browse files
committed
updated
1 parent eab534f commit 28620f9

File tree

6 files changed

+259
-2
lines changed

6 files changed

+259
-2
lines changed

docs/developer/tools/2_create_tool.md renamed to docs/developer/tools/create_tool.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
sidebar_position: 2
3+
---
14
# Creating Your First Tool
25

36
This guide walks you through creating a complete Codebolt tool from scratch. You'll learn how to set up the configuration, implement functionality, and test your tool using both the Codebolt Application and CLI.

docs/developer/tools/1_tools.md renamed to docs/developer/tools/overview.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
---
2+
sidebar_position: 1
3+
---
14
# Tools Overview
25

36
Codebolt Tools are custom utilities that extend the capabilities of AI agents by providing specialized functionality. Built on the Model Context Protocol (MCP) standard, these tools allow you to integrate external services, automate tasks, and create domain-specific capabilities that agents can use when solving problems.
47

8+
:::info MCP Compatibility
9+
Codebolt Tools are built on the Model Context Protocol (MCP) standard, ensuring full backward compatibility. This means that any existing MCP implementation can be used as a Codebolt tool without modification. This compatibility allows developers to:
10+
11+
- Use existing MCP tools directly in Codebolt
12+
- Share tools between different MCP-compatible platforms
13+
- Leverage the broader MCP ecosystem
14+
- Maintain consistency with MCP standards and best practices
15+
:::
16+
17+
18+
519
## What are Codebolt Tools?
620

721
Codebolt Tools are MCP-compatible utilities that:
@@ -51,7 +65,7 @@ my-tool/
5165

5266
### 1. Tool Definition
5367

54-
Tools are defined in `codebolttool.yaml`:
68+
Tools are defined in `codebolttool.yaml`. This allows for identification of tools in registry and codebolt application.
5569

5670
```yaml
5771
name: "File Manager"
@@ -73,7 +87,7 @@ parameters:
7387
7488
### 2. Tool Implementation
7589
76-
Tools implement MCP-compatible functions:
90+
The tool implementation is a javascript class that extends the ToolBox class. The ToolBox class is a MCP-compatible class that provides the tool functionality. This is similar to [FastMCP](https://github.com/punkpeye/fastmcp) library, although you can use any MCP-compatible library.
7791
7892
```javascript
7993
// index.js

docs/developer/tools/4_publish_tool.md renamed to docs/developer/tools/publish_tool.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
sidebar_position: 4
3+
---
14
# Publishing Tools
25

36
Once you've created and tested your tool, you can publish it to the Codebolt Tool Registry to share it with the community. This guide covers the entire publishing process, from preparation to maintenance.

docs/developer/tools/quickstart.md

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
---
2+
sidebar_position: 1.5
3+
sidebar_label: Quickstart
4+
---
5+
6+
# Quickstart
7+
8+
This guide will walk you through creating your first Codebolt tool in under 10 minutes. For detailed explanations, see the [complete documentation](./tools.md).
9+
10+
## Prerequisites
11+
12+
- Node.js 14+ installed
13+
- Codebolt CLI installed: `npm install -g codebolt-cli`
14+
- Codebolt account (sign up at [portal.codebolt.ai](https://portal.codebolt.ai))
15+
16+
## Step 1: Login and Create Tool
17+
18+
Go the the main directory of your project and run the following commands:
19+
20+
```bash
21+
# Login to Codebolt
22+
npx codebolt-cli login
23+
24+
# Create a new tool
25+
npx codebolt-cli createtool --name "Hello World Tool" --id "hello-world-tool"
26+
```
27+
28+
This will create a new tool directory in the `.codeboltAgents/tools` directory.
29+
30+
```bash
31+
# Navigate to tool directory
32+
cd .codeboltAgents/tools/hello-world-tool
33+
```
34+
35+
36+
## Step 2: Configure Your Tool
37+
38+
The tool details are written in [`codebolttool.yaml`](`codebolttool.yaml`). Edit `codebolttool.yaml`:
39+
40+
```yaml
41+
name: "Hello World Tool"
42+
description: "A simple greeting tool"
43+
version: "1.0.0"
44+
uniqueName: "hello-world-tool"
45+
46+
parameters:
47+
name:
48+
type: "string"
49+
description: "Name to greet"
50+
default: "World"
51+
```
52+
53+
## Step 3: Implement Tool Logic
54+
55+
The Tool Logic is written using [ToolBox class](./tools.md#toolbox-class). Replace `index.js` content:
56+
57+
```javascript
58+
const { ToolBox } = require('@codebolt/toolbox');
59+
60+
class HelloWorldTool {
61+
constructor(config) {
62+
this.toolbox = new ToolBox({
63+
name: 'Hello World Tool',
64+
version: '1.0.0'
65+
});
66+
67+
this.setupTools();
68+
}
69+
70+
setupTools() {
71+
this.toolbox.addTool({
72+
name: 'greet',
73+
description: 'Generate a greeting message',
74+
parameters: {
75+
name: {
76+
type: 'string',
77+
description: 'Name to greet',
78+
default: 'World'
79+
}
80+
},
81+
execute: this.greet.bind(this)
82+
});
83+
}
84+
85+
async greet(args, context) {
86+
const { name = 'World' } = args;
87+
88+
context.log.info(`Generating greeting for ${name}`);
89+
90+
return {
91+
message: `Hello, ${name}!`,
92+
timestamp: new Date().toISOString()
93+
};
94+
}
95+
96+
async start() {
97+
await this.toolbox.start();
98+
}
99+
}
100+
101+
module.exports = HelloWorldTool;
102+
```
103+
104+
## Step 4: Test Your Tool
105+
106+
[Codebolt CLI](../cli/overview.md) provides a way to test the tool locally.
107+
108+
```bash
109+
# Test the greet function
110+
npx codebolt-cli runtool greet ./index.js
111+
112+
# When prompted, enter: {"name": "Developer"}
113+
# Expected output: {"message": "Hello, Developer!", "timestamp": "..."}
114+
```
115+
116+
You can also use the interactive inspector to debug the tool.
117+
```bash
118+
# Use interactive inspector for debugging
119+
npx codebolt-cli inspecttool ./index.js
120+
```
121+
122+
## Step 5: Test Your Tool in Codebolt Application
123+
124+
Open the Codebolt Application and open the current project.
125+
126+
127+
128+
## Step 6: Publish Your Tool
129+
130+
```bash
131+
# Publish to registry
132+
codebolt-cli publishtool
133+
134+
# Follow the prompts:
135+
# - GitHub URL (optional)
136+
# - Category: "Utility"
137+
# - Tags: "greeting,hello,demo"
138+
# - Requires API key: No
139+
```
140+
141+
## Step 7: Use Your Tool
142+
143+
```bash
144+
# Install your published tool
145+
codebolt-cli installtool hello-world-tool
146+
147+
# Use in another project
148+
codebolt-cli runtool greet hello-world-tool
149+
```
150+
151+
## Quick Commands Reference
152+
153+
```bash
154+
# Tool Management
155+
codebolt-cli createtool # Create new tool
156+
codebolt-cli runtool <function> <file> # Test tool function
157+
codebolt-cli inspecttool <file> # Debug tool interactively
158+
codebolt-cli publishtool # Publish to registry
159+
160+
# Registry Operations
161+
codebolt-cli searchtools <query> # Search tools
162+
codebolt-cli installtool <tool-name> # Install tool
163+
codebolt-cli listtools --installed # List installed tools
164+
codebolt-cli updatetool <tool-name> # Update tool
165+
```
166+
167+
## Example Use Cases
168+
169+
### API Integration Tool
170+
```bash
171+
codebolt-cli createtool --name "Weather Tool" --id "weather-tool"
172+
# Add API key parameter and fetch weather data
173+
```
174+
175+
### File Processing Tool
176+
```bash
177+
codebolt-cli createtool --name "CSV Parser" --id "csv-parser"
178+
# Add file reading and CSV parsing logic
179+
```
180+
181+
### Data Transformation Tool
182+
```bash
183+
codebolt-cli createtool --name "JSON Formatter" --id "json-formatter"
184+
# Add JSON validation and formatting functions
185+
```
186+
187+
## Next Steps
188+
189+
Now that you've created your first tool, explore:
190+
191+
- **[Complete Tools Guide](./tools.md)** - Detailed concepts and patterns
192+
- **[Testing Guide](./testlocalmcp.md)** - Comprehensive testing strategies
193+
- **[Publishing Guide](./publish_tool.md)** - Advanced publishing features
194+
- **[Tool Registry](./tool_registry.md)** - Discover and manage tools
195+
196+
## Troubleshooting
197+
198+
**Tool not working?**
199+
```bash
200+
# Check configuration
201+
cat codebolttool.yaml
202+
203+
# Validate tool
204+
codebolt-cli runtool greet ./index.js
205+
```
206+
207+
**Publishing failed?**
208+
```bash
209+
# Check authentication
210+
codebolt-cli whoami
211+
212+
# Verify unique name
213+
codebolt-cli searchtools hello-world-tool
214+
```
215+
216+
**Need help?**
217+
```bash
218+
# Get help
219+
codebolt-cli help
220+
221+
# Check tool status
222+
codebolt-cli toolstatus hello-world-tool
223+
```
224+
225+
---
226+
227+
🎉 **Congratulations!** You've created, tested, and published your first Codebolt tool. Start building more complex tools by exploring the detailed documentation.
228+
229+
230+
231+

docs/developer/tools/3_testlocalmcp.md renamed to docs/developer/tools/testlocalmcp.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
sidebar_position: 3
3+
---
14
# Testing Tools Locally
25

36
Testing is crucial for ensuring your tools work correctly before publishing them. This guide covers various methods for testing Codebolt tools locally, from basic CLI testing to comprehensive unit testing.

docs/developer/tools/5_tool_registry.md renamed to docs/developer/tools/tool_registry.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
sidebar_position: 5
3+
---
14
# Tool Registry
25

36
The Codebolt Tool Registry is a centralized repository where developers can discover, share, and manage tools. This guide covers how to find tools, install them, and manage your tool collection.

0 commit comments

Comments
 (0)