-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtoolPluginHelloWorld.js
More file actions
38 lines (37 loc) · 1015 Bytes
/
toolPluginHelloWorld.js
File metadata and controls
38 lines (37 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Example of authoring a custom tool.
*
* To load this tool into the PatternFly MCP server:
* 1. Save this file (e.g., `toolPluginHelloWorld.js`)
* 2. Run the server with: `npx @patternfly/patternfly-mcp --tool <path-to-the-file>/toolPluginHelloWorld.js`
*
* Note:
* - External tool file loading requires Node.js >= 22.
* - JS support only. TypeScript is only supported for embedding the server.
* - Requires ESM default export.
*/
import { createMcpTool } from '@patternfly/patternfly-mcp';
export default createMcpTool({
name: 'helloWorld',
description: 'A simple example tool that greets the user.',
inputSchema: {
type: 'object',
properties: {
name: {
type: 'string',
description: 'The name of the person to greet.'
}
},
required: ['name']
},
async handler({ name }) {
return {
content: [
{
type: 'text',
text: `Hello, ${name}! Welcome to the PatternFly MCP ecosystem.`
}
]
};
}
});