Skip to main content
Glama
leolulu

siyuan-mcp-server

by leolulu

get_file_base64

Read a UTF-8 text file from the SiYuan knowledge base and return its content as a Base64-encoded string, masking sensitive data. Use it to access JSON files, like those in historical snapshots, without exposing raw content.

Instructions

读取指定文件内容并以 Base64 返回(只读)。

适用于需要以 Base64 形式返回的 UTF-8 文本文件(例如历史快照里的 JSON)。

注意事项: - 本实现会先按 UTF-8 解码后再打码并进行 Base64 编码。 - 若文件为纯二进制且无法 UTF-8 解码,将抛出异常(不支持二进制打码)。

Args: path: 文件路径,例如 '/history/.../blocks.msgpack'。

Returns: str: Base64 编码的文件内容(已打码)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.31.0

TDQS

A3.8/5.0
Behavior4/5

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

No annotations are provided, so the description carries full responsibility. It discloses read-only behavior, the UTF-8 decode requirement, the exception thrown for binary files, and that the content is masked before Base64 encoding. The masking step is mentioned but not fully explained.

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 well-structured with a clear purpose, usage note, args, and return value, and the main purpose is front-loaded. The only minor weakness is the undefined term '打码', but there is no wasted content.

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

Completeness4/5

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

For a one-parameter tool with an output schema, this description covers purpose, parameter format, return type, and a key failure mode. It is missing a detailed explanation of the masking behavior and permission expectations, but overall it is sufficiently complete.

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

Parameters4/5

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

Schema coverage is 0%, and the description adds real value by clarifying that path is a file path and giving a concrete example ('/history/.../blocks.msgpack'). This helps agents construct valid calls even though details like absolute vs. relative paths are absent.

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

Purpose4/5

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

The description clearly states the tool reads a file and returns its content Base64-encoded, and identifies a concrete use case (UTF-8 text files like JSON in history snapshots). It stops short of a 5 because it does not explicitly contrast with siblings like get_file or get_history_file.

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

Usage Guidelines3/5

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

It provides when-to-use context (UTF-8 text files needing Base64) and notes that binary files will fail. However, it never mentions alternative tools, so an agent must infer routing among the many file-related siblings.

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