tako-mcp 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +68 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -166,6 +166,71 @@ var OctopusClient = class {
166
166
  // src/server.ts
167
167
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
168
168
 
169
+ // src/format.ts
170
+ function formatAccount(account) {
171
+ const lines = [
172
+ "account:",
173
+ ` number: "${account.number}"`,
174
+ ` status: ${account.status}`,
175
+ ` balance: ${account.balance}`,
176
+ " properties:"
177
+ ];
178
+ for (const prop of account.properties) {
179
+ lines.push(` - id: "${prop.id}"`, " supplyPoints:");
180
+ for (const sp of prop.electricitySupplyPoints) {
181
+ lines.push(
182
+ ` - spin: "${sp.spin}"`,
183
+ ` status: ${sp.status}`
184
+ );
185
+ const serials = sp.meters.map((m) => m.serialNumber);
186
+ if (serials.length > 0) {
187
+ lines.push(` meters: [${serials.join(", ")}]`);
188
+ }
189
+ if (sp.agreements.length > 0) {
190
+ lines.push(" agreements:");
191
+ for (const a of sp.agreements) {
192
+ lines.push(` - from: "${a.validFrom}"`);
193
+ lines.push(
194
+ ` to: ${a.validTo ? `"${a.validTo}"` : "null"}`
195
+ );
196
+ lines.push(` plan: ${a.product?.displayName ?? "null"}`);
197
+ if (a.product?.standingChargePricePerDay) {
198
+ lines.push(
199
+ ` dailyCharge: ${a.product.standingChargePricePerDay}`
200
+ );
201
+ }
202
+ }
203
+ }
204
+ }
205
+ }
206
+ return lines.join("\n");
207
+ }
208
+ function formatConsumption(readings) {
209
+ const lines = ["readings:"];
210
+ for (const r of readings) {
211
+ lines.push(` - start: "${r.startAt}"`, ` kWh: ${r.value}`);
212
+ if (r.costEstimate) {
213
+ lines.push(` cost: ${r.costEstimate}`);
214
+ }
215
+ if (r.consumptionRateBand) {
216
+ lines.push(` band: ${r.consumptionRateBand}`);
217
+ }
218
+ }
219
+ return lines.join("\n");
220
+ }
221
+ function formatPostalAreas(areas) {
222
+ const lines = ["areas:"];
223
+ for (const a of areas) {
224
+ lines.push(
225
+ ` - postcode: "${a.postcode}"`,
226
+ ` prefecture: ${a.prefecture}`,
227
+ ` city: ${a.city}`,
228
+ ` area: ${a.area}`
229
+ );
230
+ }
231
+ return lines.join("\n");
232
+ }
233
+
169
234
  // src/tools/account.ts
170
235
  function registerAccountTools(server, client2) {
171
236
  server.registerTool(
@@ -185,9 +250,7 @@ function registerAccountTools(server, client2) {
185
250
  }))
186
251
  };
187
252
  return {
188
- content: [
189
- { type: "text", text: JSON.stringify(sanitized, null, 2) }
190
- ]
253
+ content: [{ type: "text", text: formatAccount(sanitized) }]
191
254
  };
192
255
  }
193
256
  );
@@ -207,9 +270,7 @@ function registerAreaTools(server, client2) {
207
270
  async (args) => {
208
271
  const data = await client2.getPostalAreas(args.postcode);
209
272
  return {
210
- content: [
211
- { type: "text", text: JSON.stringify(data, null, 2) }
212
- ]
273
+ content: [{ type: "text", text: formatPostalAreas(data) }]
213
274
  };
214
275
  }
215
276
  );
@@ -237,9 +298,7 @@ function registerConsumptionTools(server, client2) {
237
298
  args.period_to
238
299
  );
239
300
  return {
240
- content: [
241
- { type: "text", text: JSON.stringify(data, null, 2) }
242
- ]
301
+ content: [{ type: "text", text: formatConsumption(data) }]
243
302
  };
244
303
  }
245
304
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tako-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for Octopus Energy API",
5
5
  "type": "module",
6
6
  "bin": {