one_piece
Retrieve detailed information about One Piece anime characters by entering their unique ID. Part of MCP Servers for character and geolocation queries.
Instructions
Herramienta para buscar informacion sobre personajes de One Piece
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Id del personaje |
Implementation Reference
- onePiece.ts:17-67 (handler)The main handler function for the 'one_piece' tool. It takes an 'id' parameter, checks if it's a keyword for listing all characters, otherwise fetches specific character data from the One Piece API, handles errors, and returns formatted content.async ({ id }) => { const filtros = ["lista", "personajes", "todos", "all", "*", "characters"]; if(filtros.includes(id)) { try { const response = await axios.get(`https://onepieceapi-50cm.onrender.com/personajes`); const data = response.data; return { content: [ { type: 'text', text: `Información de los personajes: ${JSON.stringify(data)}`, } ] }; } catch (e) { return { content: [ { type: 'text', text: `Error al buscar el personaje: ${e.message}`, } ], isError: true }; } } else { try { const response = await axios.get(`https://onepieceapi-50cm.onrender.com/personaje/${id}`); const data = response.data; return { content: [ { type: 'text', text: `Información del personaje: ${JSON.stringify(data)}`, } ] }; } catch (e) { return { content: [ { type: 'text', text: `Error al buscar el personaje: ${e.message}`, } ], isError: true }; } } }
- onePiece.ts:14-16 (schema)Zod schema defining the input parameter 'id' as a required non-empty string for the character ID.{ id: z.string().min(1, 'El id del personaje es requerido').describe('Id del personaje'), },
- onePiece.ts:11-68 (registration)Registration of the 'one_piece' tool on the MCP server, specifying name, description, input schema, and handler function.server.tool( 'one_piece', 'Herramienta para buscar informacion sobre personajes de One Piece', { id: z.string().min(1, 'El id del personaje es requerido').describe('Id del personaje'), }, async ({ id }) => { const filtros = ["lista", "personajes", "todos", "all", "*", "characters"]; if(filtros.includes(id)) { try { const response = await axios.get(`https://onepieceapi-50cm.onrender.com/personajes`); const data = response.data; return { content: [ { type: 'text', text: `Información de los personajes: ${JSON.stringify(data)}`, } ] }; } catch (e) { return { content: [ { type: 'text', text: `Error al buscar el personaje: ${e.message}`, } ], isError: true }; } } else { try { const response = await axios.get(`https://onepieceapi-50cm.onrender.com/personaje/${id}`); const data = response.data; return { content: [ { type: 'text', text: `Información del personaje: ${JSON.stringify(data)}`, } ] }; } catch (e) { return { content: [ { type: 'text', text: `Error al buscar el personaje: ${e.message}`, } ], isError: true }; } } } )