zerodb_renew_token
Renew authentication token to maintain access to vector search and persistent memory capabilities for cross-session context storage and retrieval.
Instructions
Manually renew authentication token
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:1188-1206 (handler)The main handler function for the 'zerodb_renew_token' tool. It calls renewToken() and returns success/error response in MCP format.async manualTokenRenewal () { try { await this.renewToken() return { content: [{ type: 'text', text: `Token renewed successfully. Expires at: ${new Date(this.tokenExpiry).toISOString()}` }] } } catch (error) { return { content: [{ type: 'text', text: `Token renewal failed: ${error.message}` }], isError: true } } }
- index.js:1156-1186 (helper)Core helper function that performs the actual token renewal by posting credentials to the login endpoint and updating the instance's apiToken and tokenExpiry.async renewToken () { try { console.error('Renewing authentication token...') const response = await axios.post( `${this.apiUrl}/v1/public/auth/login-json`, { username: this.username, password: this.password }, { headers: { 'Content-Type': 'application/json' }, timeout: 10000 // 10 second timeout } ) if (response.data && response.data.access_token) { this.apiToken = response.data.access_token this.tokenExpiry = Date.now() + ((response.data.expires_in || 1800) * 1000) // Default 30 minutes console.error('Token renewed successfully') return true } else { throw new Error('Invalid response format: missing access_token') } } catch (error) { // Security: Don't log full error response which may contain sensitive data const safeError = error.response?.status ? `HTTP ${error.response.status}` : error.message console.error('Token renewal failed:', safeError) throw new Error(`Authentication failed: ${error.response?.status === 401 ? 'Invalid credentials' : 'Connection error'}`) } }
- index.js:900-908 (schema)Schema definition for the zerodb_renew_token tool, registered in the listTools response. No input parameters required.{ name: 'zerodb_renew_token', description: 'Manually renew authentication token', inputSchema: { type: 'object', properties: {}, required: [] } }
- index.js:1055-1057 (registration)Registration/routing of the zerodb_renew_token tool in the routeToolCall switch statement, mapping it to the manualTokenRenewal handler.case 'zerodb_renew_token': return await this.manualTokenRenewal()