Skip to main content
Glama

article

Retrieve articles from Zenn.dev by specifying author, topic, order, page, or count using Zenn MCP Server’s API for streamlined content fetching.

Instructions

Fetch articles from Zenn.dev

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of articles per page. Default: 48
orderNoOrder of the articles. Choose from latest or oldest
pageNoPage number of the articles. Default: 1
topicnameNoTopic name of the article
usernameNoUsername of the article author

Implementation Reference

  • Handler that processes the arguments for the 'article' tool, parses them into an Article object, and fetches the articles.
    async def handle_articles(arguments: dict) -> dict: query = Article.from_arguments(arguments) return await fetch_articles(query)
  • Executes the core logic for the 'article' tool by making an HTTP request to the Zenn API with the provided query parameters.
    async def fetch_articles(query: Article) -> dict: return await request(URLResource.ARTICLES, query.to_query_param())
  • Pydantic model for 'article' tool input schema, including field definitions, argument parsing (from_arguments), query param building (to_query_param), and Tool schema definition (tool()).
    class Article(BaseModel): """Fetch articles from Zenn.dev""" model_config = ConfigDict( validate_assignment=True, frozen=True, extra="forbid", ) username: Optional[str] = Field(default=None, description="Username of the article author") topicname: Optional[str] = Field(default=None, description="Topic name of the article") order: Optional[Order] = Field( default=Order.LATEST, description=f"Order of the articles. Choose from {Order.LATEST.value} or {Order.OLDEST.value}", ) page: Optional[int] = Field(default=1, description="Page number of the articles. Default: 1") count: Optional[int] = Field(default=48, description="Number of articles per page. Default: 48") @staticmethod def from_arguments(arguments: dict) -> "Article": return Article( username=arguments.get("username"), topicname=arguments.get("topicname"), order=Order.from_str(arguments.get("order", Order.LATEST.value)), page=arguments.get("page", 1), count=arguments.get("count", 48), ) def to_query_param(self) -> dict: param = {} if self.username: param["username"] = self.username.lower() if self.topicname: param["topicname"] = self.topicname.lower() if self.order: param["order"] = self.order.value if self.page: param["page"] = self.page if self.count: param["count"] = self.count return param @staticmethod def tool() -> Tool: return Tool( name=ZennTool.ARTICLE.value, description="Fetch articles from Zenn.dev", inputSchema={ "type": "object", "properties": { "username": {"type": "string", "description": Article.model_fields["username"].description}, "topicname": {"type": "string", "description": Article.model_fields["topicname"].description}, "order": { "type": "string", "description": Article.model_fields["order"].description, "enum": [Order.LATEST.value, Order.OLDEST.value], }, "page": {"type": "integer", "description": Article.model_fields["page"].description}, "count": {"type": "integer", "description": Article.model_fields["count"].description}, }, "required": [], }, )
  • Registers the 'article' tool with the MCP server by including it in the list of available tools.
    @server.list_tools() async def list_tools() -> list[Tool]: return [Article.tool(), Book.tool()]
  • MCP server call_tool handler that dispatches calls to the 'article' tool (when name == 'article') to the specific handle_articles function and returns the JSON result as TextContent.
    @server.call_tool() async def call_tool( name: str, arguments: dict, ) -> Sequence[TextContent | ImageContent | EmbeddedResource]: try: logger.debug(f"Calling tool: {name} with arguments: {arguments}") match name: case ZennTool.ARTICLE.value: result = await handle_articles(arguments) case ZennTool.BOOK.value: result = await handle_books(arguments) case _: raise ValueError(f"Unknown tool: {name}") return [TextContent(type="text", text=json.dumps(result, indent=2, ensure_ascii=False))] except Exception as e: logger.error(f"Error processing {APP_NAME} query: {str(e)}") raise ValueError(f"Error processing {APP_NAME} query: {str(e)}")

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/shibuiwilliam/mcp-server-zenn'

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