Skip to main content
Glama
TeeDDub

Aladin Book Search MCP Server

by TeeDDub

도서 검색

search_books

Search for books on Aladin by title, author, publisher, or keyword. Retrieve results with customizable parameters such as maximum results and starting index for precise book discovery.

Instructions

알라딘에서 도서를 검색합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNo최대 결과 개수
queryYes검색어
searchTypeNo검색 타입Title
startNo검색 시작 번호

Implementation Reference

  • The anonymous async handler function that implements the core logic of the 'search_books' tool, performing the Aladin API search and processing results into BookSearchResult objects.
    async ({ query, searchType, maxResults, start }) => {
      try {
        if (!query) {
          throw new Error('검색어를 입력해주세요.');
        }
    
        const params = {
          Query: query,
          QueryType: searchType,
          MaxResults: maxResults,
          start: start,
          SearchTarget: 'Book',
          Cover: 'Big'
        };
    
        const result = await callAladinApi('ItemSearch.aspx', params);
        
        const books: BookSearchResult[] = result.item?.map((item: any) => ({
          title: item.title || '',
          author: item.author || '',
          publisher: item.publisher || '',
          pubDate: item.pubDate || '',
          isbn: item.isbn || '',
          isbn13: item.isbn13 || '',
          cover: item.cover || '',
          categoryName: item.categoryName || '',
          description: item.description || '',
          priceStandard: item.priceStandard || 0,
          priceSales: item.priceSales || 0,
          link: item.link || '',
          pages: item.subInfo?.itemPage || undefined,
          pricePerPage: (item.priceStandard > 0 && item.subInfo?.itemPage > 0) 
            ? parseFloat((item.priceStandard / item.subInfo.itemPage).toFixed(2)) 
            : undefined
        })) || [];
    
        return {
          content: [{
            type: 'text',
            text: `📚 도서 검색 결과 (${query})\n\n검색된 도서 수: ${books.length}권\n\n${JSON.stringify(books, null, 2)}`
          }]
        };
      } catch (error) {
        logger.error(`도서 검색 중 오류 발생: ${error}`);
        return {
          content: [{
            type: 'text',
            text: `도서 검색 중 오류가 발생했습니다: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    }
  • Zod input schema definition for the 'search_books' tool parameters.
    inputSchema: {
      query: z.string().describe('검색어'),
      searchType: z.enum(['Title', 'Author', 'Publisher', 'Keyword']).default('Title').describe('검색 타입'),
      maxResults: z.number().min(1).max(100).default(10).describe('최대 결과 개수'),
      start: z.number().min(1).default(1).describe('검색 시작 번호')
    }
  • src/index.ts:177-242 (registration)
    Registration of the 'search_books' MCP tool using server.registerTool, including title, description, input schema, and inline handler.
    server.registerTool(
      'search_books',
      {
        title: '도서 검색',
        description: '알라딘에서 도서를 검색합니다.',
        inputSchema: {
          query: z.string().describe('검색어'),
          searchType: z.enum(['Title', 'Author', 'Publisher', 'Keyword']).default('Title').describe('검색 타입'),
          maxResults: z.number().min(1).max(100).default(10).describe('최대 결과 개수'),
          start: z.number().min(1).default(1).describe('검색 시작 번호')
        }
      },
      async ({ query, searchType, maxResults, start }) => {
        try {
          if (!query) {
            throw new Error('검색어를 입력해주세요.');
          }
    
          const params = {
            Query: query,
            QueryType: searchType,
            MaxResults: maxResults,
            start: start,
            SearchTarget: 'Book',
            Cover: 'Big'
          };
    
          const result = await callAladinApi('ItemSearch.aspx', params);
          
          const books: BookSearchResult[] = result.item?.map((item: any) => ({
            title: item.title || '',
            author: item.author || '',
            publisher: item.publisher || '',
            pubDate: item.pubDate || '',
            isbn: item.isbn || '',
            isbn13: item.isbn13 || '',
            cover: item.cover || '',
            categoryName: item.categoryName || '',
            description: item.description || '',
            priceStandard: item.priceStandard || 0,
            priceSales: item.priceSales || 0,
            link: item.link || '',
            pages: item.subInfo?.itemPage || undefined,
            pricePerPage: (item.priceStandard > 0 && item.subInfo?.itemPage > 0) 
              ? parseFloat((item.priceStandard / item.subInfo.itemPage).toFixed(2)) 
              : undefined
          })) || [];
    
          return {
            content: [{
              type: 'text',
              text: `📚 도서 검색 결과 (${query})\n\n검색된 도서 수: ${books.length}권\n\n${JSON.stringify(books, null, 2)}`
            }]
          };
        } catch (error) {
          logger.error(`도서 검색 중 오류 발생: ${error}`);
          return {
            content: [{
              type: 'text',
              text: `도서 검색 중 오류가 발생했습니다: ${error instanceof Error ? error.message : String(error)}`
            }],
            isError: true
          };
        }
      }
    );
  • TypeScript interface defining the structure of book search results used in the 'search_books' handler.
    interface BookSearchResult {
      title: string;
      author: string;
      publisher: string;
      pubDate: string;
      isbn: string;
      isbn13: string;
      cover: string;
      categoryName: string;
      description: string;
      priceStandard: number;
      priceSales: number;
      link: string;
      pages?: number; // 페이지 수 추가
      pricePerPage?: number; // 쪽단가 추가
    }
  • Utility helper function to make authenticated calls to the Aladin API, invoked by the 'search_books' handler.
    async function callAladinApi(endpoint: string, params: Record<string, any>): Promise<any> {
      if (!ALADIN_TTB_KEY || ALADIN_TTB_KEY.length === 0) {
        throw new Error('알라딘 API 키가 설정되지 않았습니다. ALADIN_TTB_KEY 환경변수를 올바르게 설정해주세요.');
      }
    
      const baseParams = {
        ttbkey: ALADIN_TTB_KEY,
        output: 'js',
        version: '20131101'
      };
    
      const finalParams = { ...baseParams, ...params };
      const url = `${ALADIN_BASE_URL}/${endpoint}`;
    
      try {
        const response = await axios.get(url, { params: finalParams });
        return response.data;
      } catch (error) {
        logger.error(`알라딘 API 호출 오류: ${error}`);
        throw error;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden but adds minimal behavioral context. It mentions the platform ('Aladin') but doesn't disclose rate limits, authentication needs, pagination behavior, or what the output looks like (e.g., list of books with details). This is inadequate for a search tool with no structured safety hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Korean that directly states the tool's function. It's front-loaded with no wasted words, though it could be slightly more informative without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits, output format, and differentiation from siblings, making it insufficient for an agent to use effectively without trial and error.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no additional meaning beyond implying a general search function, which the schema already covers with 'query' and 'searchType'. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('search') and resource ('books on Aladin'), which is clear but vague. It doesn't specify what kind of search this is (e.g., full-text, filtered) or how it differs from siblings like 'search_categories', leaving room for ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'get_bestsellers' or 'search_categories', there's no indication of context, prerequisites, or exclusions, leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TeeDDub/mcp-aladin-books-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server