update_external_market_config
Modify and synchronize external market data API configurations, including URL, API key, and symbol mappings, for accurate and up-to-date market data integration.
Instructions
Update the configuration for external market data API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | API key for external market data (if required) | |
| apiUrl | No | API URL for external market data | |
| symbols | No | Symbol mappings for the external API |
Input Schema (JSON Schema)
{
"properties": {
"apiKey": {
"description": "API key for external market data (if required)",
"type": "string"
},
"apiUrl": {
"description": "API URL for external market data",
"type": "string"
},
"symbols": {
"description": "Symbol mappings for the external API",
"properties": {
"EDU": {
"description": "Symbol for EDU token on the external API",
"type": "string"
},
"USD": {
"description": "Symbol for USD on the external API",
"type": "string"
}
},
"type": "object"
}
},
"required": [],
"type": "object"
}
Implementation Reference
- src/index.ts:634-665 (registration)Tool registration in the listTools response, including name 'update_external_market_config', description, and inputSchema definition.{ name: 'update_external_market_config', description: 'Update the configuration for external market data API', inputSchema: { type: 'object', properties: { apiUrl: { type: 'string', description: 'API URL for external market data', }, apiKey: { type: 'string', description: 'API key for external market data (if required)', }, symbols: { type: 'object', properties: { EDU: { type: 'string', description: 'Symbol for EDU token on the external API', }, USD: { type: 'string', description: 'Symbol for USD on the external API', }, }, description: 'Symbol mappings for the external API', }, }, required: [], }, },
- src/index.ts:1316-1370 (handler)MCP tool handler for 'update_external_market_config' that parses the input arguments, constructs the newConfig object, calls external_market.updateConfig(newConfig), retrieves current config, and returns success response with updated config.case 'update_external_market_config': { try { const newConfig: any = {}; if (typeof args.apiUrl === 'string') { newConfig.apiUrl = args.apiUrl; } if (typeof args.apiKey === 'string') { newConfig.apiKey = args.apiKey; } if (typeof args.symbols === 'object' && args.symbols !== null) { newConfig.symbols = {} as { EDU: string; USD: string }; if (typeof (args.symbols as any).EDU === 'string') { newConfig.symbols.EDU = (args.symbols as any).EDU; } if (typeof (args.symbols as any).USD === 'string') { newConfig.symbols.USD = (args.symbols as any).USD; } } external_market.updateConfig(newConfig); const currentConfig = external_market.getConfig(); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'External market API configuration updated', config: currentConfig }, null, 2), }, ], }; } catch (error) { console.error('Error updating external market config:', error); return { content: [ { type: 'text', text: JSON.stringify({ error: 'Failed to update external market API configuration', message: (error as Error).message }, null, 2), }, ], isError: true, }; } }
- src/external_market.ts:44-57 (helper)Core helper function updateConfig that merges new configuration into the global config and persists it to config/external_market_config.json file.export function updateConfig(newConfig: Partial<typeof config>): void { config = { ...config, ...newConfig }; // Save updated config to file try { const configDir = path.join(__dirname, '..', 'config'); if (!fs.existsSync(configDir)) { fs.mkdirSync(configDir, { recursive: true }); } fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); } catch (error) { console.error('Error saving external market config:', error); } }
- src/index.ts:637-664 (schema)Input schema for update_external_market_config tool defining properties apiUrl, apiKey, and symbols object.inputSchema: { type: 'object', properties: { apiUrl: { type: 'string', description: 'API URL for external market data', }, apiKey: { type: 'string', description: 'API key for external market data (if required)', }, symbols: { type: 'object', properties: { EDU: { type: 'string', description: 'Symbol for EDU token on the external API', }, USD: { type: 'string', description: 'Symbol for USD on the external API', }, }, description: 'Symbol mappings for the external API', }, }, required: [], },