get_isbn
Retrieve detailed book information by inputting an ISBN through the Brasil API MCP server, enabling quick access to essential data for AI agents and applications.
Instructions
Get information about a book given an ISBN.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ISBN | Yes | The book's ISBN to query |
Implementation Reference
- src/tools/isbn.ts:20-34 (handler)The asynchronous handler function that executes the tool logic: fetches book information from BrasilAPI using the provided ISBN, formats the response, and handles errors.handler: async ({ ISBN }): Promise<McpResponse> => { try { const result = await brasilApiClient.isbn.getBy(ISBN); const content: McpTextContent = { type: "text", text: `Book with ISBN ${ISBN} found:\n${prettifyJson(result.data)}`, }; return { content: [content], }; } catch (error: any) { console.error(error); throw new Error(`Failed to fetch book with ISBN ${ISBN}`); } },
- src/tools/isbn.ts:10-14 (schema)Zod schema defining the input parameters for the 'get_isbn' tool: a single 'ISBN' string parameter.const getISBNToolParams = { ISBN: z.string().describe("The book's ISBN to query"), }; type GetISBNToolParams = typeof getISBNToolParams;
- src/index.ts:30-41 (registration)The tool is imported (line 8) and registered by adding it to the tools array and calling registerTool(server, tool) for each tool on the MCP server.const tools = [ getCepTool, getCepV2Tool, getBookByISBNTool, getCNPJTool, getAllBanksTool, getBankByCodeTool, ]; tools.forEach((tool) => { registerTool(server, tool); });