create-token
Generate authentication tokens for AI assistants to access Terminal.shop's API, enabling product browsing, cart management, order placement, and subscription handling.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:1104-1130 (handler)The inline handler for the "create-token" tool, registered directly in the server.tool call. It creates a personal access token by sending a POST request to the "/token" endpoint using the terminalApi client, returns a formatted success message containing the token ID and token value, and handles errors appropriately.// Tool to create a personal access token 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 (registration)Registers the "create-token" tool on the MCP server with an empty input schema (no parameters required). The handler is defined inline.server.tool("create-token", {}, async () => {
- server.js:1105-1105 (schema)Empty input schema for the create-token tool, indicating no input parameters are required.server.tool("create-token", {}, async () => {