browse
Open your browser to view detailed information about a specific Douban book using its unique ID.
Instructions
open default browser and browse douban book detail
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | douban book id, e.g. "1234567890" |
Implementation Reference
- src/index.ts:189-202 (handler)Handler function that validates the book ID, opens the Douban book detail page in the default browser using the 'open' package, and returns a confirmation message.async (args) => { if (!args.id) { throw new McpError(ErrorCode.InvalidParams, "douban book id must be provided") } await open(`https://book.douban.com/subject/${args.id}/`); return { content: [{ type: "text", text: `The Douban Book Page has been opened in your default browser`, }] } }
- src/index.ts:186-188 (schema)Zod schema for the tool input, defining the required 'id' parameter as a string.{ id: z.string().describe('douban book id, e.g. "1234567890"') },
- src/index.ts:183-203 (registration)Registers the 'browse' tool on the MCP server with name TOOL.BROWSE, description, input schema, and handler function.server.tool( TOOL.BROWSE, "open default browser and browse douban book detail", { id: z.string().describe('douban book id, e.g. "1234567890"') }, async (args) => { if (!args.id) { throw new McpError(ErrorCode.InvalidParams, "douban book id must be provided") } await open(`https://book.douban.com/subject/${args.id}/`); return { content: [{ type: "text", text: `The Douban Book Page has been opened in your default browser`, }] } } );
- src/types.ts:1-9 (helper)TypeScript enum TOOL defining the constant BROWSE = 'browse' used as the tool name in registration.export enum TOOL { SEARCH_BOOK = 'search-book', LIST_BOOK_REVIEWS = 'list-book-reviews', SEARCH_MOVIE = 'search-movie', LIST_MOVIE_REVIEWS = 'list-movie-reviews', BROWSE = 'browse', LIST_GROUP_TOPICS = 'list-group-topics', GET_GROUP_TOPIC_DETAIL = 'get-group-topic-detail' }