This is an example project that illustrates how to build a Vertesia Agent Tool Server. It demonstrates the structure, patterns for creating custom tool collections that can be used by Vertesia agents.
Before using this tool server, you need to configure JIRA with a service account:
-
Create a service account with OAuth 2.0 credentials in your Atlassian organization
-
Obtain OAuth 2.0 credentials:
clientId: Your OAuth client IDclientSecret: Your OAuth client secret
-
Get your Cloud ID:
- This identifies your JIRA Cloud instance from https://my-team-domain.atlassian.net/_edge/tenant_info
Finally, configure the credentials in this project by editing src/collections/jira/creds.ts:
export const creds = {
clientId: "",
clientSecret: "",
cloudId: "",
projectKey: ""
}Note: This file-based approach is used for simplicity of deployment in this example. In production, you should use environment variables instead.
src/
├── collections/ # Tool collections
│ ├── jira/ # JIRA collection
│ │ ├── icon.svg.ts # Collection icon
│ │ ├── index.ts # Collection definition
│ │ ├── JiraClient.ts # JIRA API client
│ │ ├── creds.ts # Credentials (for demo only; use env vars in production)
│ │ ├── current_user/ # Get current user tool
│ │ │ ├── manifest.ts # Tool schema/metadata
│ │ │ └── currentUser.ts # Tool implementation
│ │ └── create_issue/ # Create issue tool
│ │ ├── manifest.ts # Tool schema/metadata
│ │ └── createIssue.ts # Tool implementation
│ └── index.ts # Export all collections
├── server.ts # Hono server with collection endpoints
└── index.ts # Main exportsStart the development server:
pnpm install
pnpm devThe server will be available at http://localhost:5174/api
GET /api- List all collectionsGET /api/jira- Get collection metadata and tool definitionsPOST /api/jira- Execute a tool in the collection
Get the example collection tools:
curl http://localhost:5174/api/jiraExecute the current_user tool:
curl -X POST http://localhost:5174/api/jira \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"tool_use": {
"id": "test-123",
"tool_name": "current_user",
"tool_input": {}
}
}'- Create a new directory under
src/collections/jira/(e.g.,my-tool/) - Create
manifest.tswith your tool's schema - Create
MyTool.tswith the implementation - Add the tool to
src/collections/jira/index.ts
- Create a new directory under
src/collections/(e.g.,my-collection/) - Create
icon.svg.tswith an SVG icon - Create
index.tsto define the collection - Add your tools in subdirectories
- Export the collection in
src/collections/index.ts
Tools receive authentication context through the ToolExecutionContext parameter:
export async function myTool(
payload: ToolExecutionPayload<MyToolParams>,
context: ToolExecutionContext
) {
// Access the decoded JWT token
const userId = context.payload.sub;
// Get a Vertesia client instance
const client = await context.getClient();
// Your tool logic here
return {
is_error: false,
content: "Tool result"
};
}Build the project:
pnpm buildThis creates an optimized build in the dist/ directory.
Your Agent Tool Server can be deployed to various platforms. The server is built with Hono, which supports multiple runtimes including Node.js, Vercel Edge Functions, Cloudflare Workers, AWS Lambda, and more.
For detailed guides on deploying to different platforms, visit the Hono documentation. The documentation provides comprehensive examples for various deployment targets and runtimes.
This section demonstrates deploying to Vercel as an example, since Vercel offers a generous free tier and simple deployment process. The project includes api/index.ts which serves as the entry point for Vercel deployment using the Hono Vercel adapter. Vercel automatically detects and configures the Edge Function.
Install the Vercel CLI globally:
npm i -g vercel-
Login to Vercel:
vercel login
-
Deploy to preview:
vercel
This will create a preview deployment and provide you with a URL to test your tool server.
-
Deploy to production:
vercel --prod
Your tool server will be available at https://your-project.vercel.app/api
For more information, visit the Vercel CLI documentation.
Test that your server is responding correctly:
curl https://your-project.vercel.app/apiYou should see a JSON response with the API information and available endpoints.
After deploying to Vercel, update your app manifest to point to the deployed URL using the vertesia CLI:
vertesia apps update <appId> --manifest '{
"name": "my-app",
"title": "My App",
"description": "A sample app",
"publisher": "your-org",
"private": true,
"status": "beta",
"tool_collections": [
"https://your-app.vercel.app/api/example"
],
}'Replace appId by the actual ID and https://your-app.vercel.app with your actual Vercel deployment URL.