dragonball-mcp 1.0.5 → 1.0.6

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.
package/dist/api.js CHANGED
@@ -64,3 +64,34 @@ export async function planets(args = {}) {
64
64
  }
65
65
  return lines.join('\n');
66
66
  }
67
+
68
+ const DRAGONBALL = 'https://dragonball-api.com/api/characters';
69
+ export async function characterDetail(args = {}) {
70
+ const id = Number(args?.id);
71
+ if (!Number.isInteger(id) || id < 1)
72
+ throw new Error('Provide a character id, like 1 for Goku.');
73
+ const res = await fetch(`${DRAGONBALL}/${id}`, {
74
+ headers: { 'User-Agent': 'mrfentmen-dragonball-mcp/1.0', Accept: 'application/json' },
75
+ signal: AbortSignal.timeout(20000),
76
+ });
77
+ if (res.status === 404)
78
+ throw new Error(`No Dragon Ball character has id ${id}`);
79
+ if (!res.ok)
80
+ throw new Error(`Dragon Ball API returned ${res.status}`);
81
+ const c = (await res.json());
82
+ if (!c?.name)
83
+ throw new Error('Dragon Ball API returned no character');
84
+ const planet = c.originPlanet;
85
+ const transforms = Array.isArray(c.transformations) ? c.transformations : [];
86
+ return [
87
+ `${c.name} (id ${c.id})`,
88
+ `Ki: ${c.ki ?? '?'}${c.maxKi ? ` · max ${c.maxKi}` : ''}`,
89
+ `Race: ${c.race ?? '?'} · gender ${c.gender ?? '?'} · ${c.affiliation ?? 'no affiliation'}`,
90
+ planet ? `Origin: ${planet.name ?? '?'}${planet.isDestroyed ? ' (destroyed)' : ''}` : 'Origin: unknown',
91
+ transforms.length
92
+ ? `Transformations (${transforms.length}): ${transforms.map((t) => `${t.name}${t.ki ? ` [${t.ki}]` : ''}`).join(', ')}`
93
+ : 'Transformations: none on record',
94
+ (c.description ?? '').trim().slice(0, 600),
95
+ 'https://dragonball-api.com/api/characters/' + c.id,
96
+ ].filter(Boolean).join('\n');
97
+ }
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
- import { character, characters, planets } from "./api.js";
3
+ import { character, characters, planets, characterDetail } from "./api.js";
4
4
  const text = (value) => ({ content: [{ type: "text", text: value }] });
5
5
  const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
6
6
  const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
@@ -39,9 +39,8 @@ export function createServer() {
39
39
  inputSchema: z.object({ id: z.number().describe("Character id, like 1 for Goku. The characters list prints ids.") }),
40
40
  annotations: READ_ONLY,
41
41
  }, async (args) => {
42
- // TODO: implement detail locally (paywall removed)
43
42
  try {
44
- return textError("Not yet implemented: detail");
43
+ return text(await characterDetail(args));
45
44
  }
46
45
  catch (e) {
47
46
  return textError(String(e));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.5",
2
+ "version": "1.0.6",
3
3
  "type": "module",
4
4
  "repository": {
5
5
  "type": "git",
@@ -41,4 +41,4 @@
41
41
  "engines": {
42
42
  "node": ">=20"
43
43
  }
44
- }
44
+ }
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/mrfentmen/dragonball-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.0.1",
9
+ "version": "1.0.6",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "dragonball-mcp",
14
- "version": "1.0.1",
14
+ "version": "1.0.6",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }