create-token
Generate API tokens for interacting with Terminal.shop, enabling AI assistants to browse products, manage carts, place orders, and handle subscriptions programmatically.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:1105-1130 (registration)Registers the 'create-token' tool with an empty input schema and an inline async handler function. The handler makes a POST request to the Terminal.shop API endpoint '/token' to create a new personal access token and returns the token ID and value in the response.server.tool("create-token", {}, async () => { try { const response = await terminalApi.post("/token"); const data = response.data.data; return { content: [ { type: "text", text: `Token created successfully!\n\nToken ID: ${data.id}\nToken: ${data.token}\n\nIMPORTANT: Save this token securely. You won't be able to see the full token value again.`, }, ], }; } catch (error) { console.error("Error creating token:", error); return { content: [ { type: "text", text: `Error creating token: ${error.message}`, }, ], isError: true, }; } });
- server.js:1105-1130 (handler)The handler function for the 'create-token' tool. It performs a POST request to '/token' using the pre-configured axios instance 'terminalApi', extracts the token data, and formats a success response with the token ID and token value. Includes error handling.server.tool("create-token", {}, async () => { try { const response = await terminalApi.post("/token"); const data = response.data.data; return { content: [ { type: "text", text: `Token created successfully!\n\nToken ID: ${data.id}\nToken: ${data.token}\n\nIMPORTANT: Save this token securely. You won't be able to see the full token value again.`, }, ], }; } catch (error) { console.error("Error creating token:", error); return { content: [ { type: "text", text: `Error creating token: ${error.message}`, }, ], isError: true, }; } });
- server.js:1105-1105 (schema)Empty input schema object for the 'create-token' tool, indicating no parameters are required.server.tool("create-token", {}, async () => {