A C# MCP server demonstration with tool integration for file operations and AI chat functionality
MCPSharpDemo provides a single tool (SaveFile) with minimal definition quality. The tool has a schema visible in the source code with parameter types (filePath: string, fileContent: string), but the description is in Chinese ('本方法作用是将文本内容写到本地计算机目标路径' = 'This method writes text content to a target path on the local computer'), which is only ~80 characters and lacks critical safety information. The tool has a high-risk WRITE operation that modifies the file system but includes no error handling guidance, no validation rules, no confirmation/dry-run pattern, and no mention of security implications or failure modes. The naming 'SaveFile' is generic and lacks a verb prefix pattern (should be 'write_file' or 'save_file_contents'). Parameter descriptions exist but are minimal and include example values ('d:/test.txt') which LLMs may reuse literally. No pagination, no structured output schema documentation, no per-parameter validation rules, and no error recovery guidance. The tool operates in isolation with no composition with other tools.
本方法作用是将文本内容写到本地计算机目标路径
Destructive operation (file write) lacks confirmation, dry-run, or permission gates. No validation of filePath (potential path traversal). Tool can silently overwrite existing files without warning.
Description is in Chinese and lacks critical metadata for LLM reasoning: no explanation of WHEN to use this tool, no mention of side effects (file overwrite), no guidance on error recovery, no constraints on path format or file size. Baseline requires 10-1024 chars with WHAT/WHEN/prerequisites.
Example value 'd:/test.txt' in parameter description trains LLMs to reuse literal paths instead of substituting user-provided values. Violates pattern guidance: replace examples with format constraints (e.g., 'valid local file path: C:/Users/.../*.txt').
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | F | 34 | 2026-07-28+ | v2 |
| 2026-03-09 | F | 31 | - | v1 |
No input validation documented. filePath parameter accepts any string, no regex pattern, no length limits, no character restrictions, no guidance on relative vs absolute paths. Parameter schema lacks constraints (minLength, maxLength, pattern).
No error handling or recovery guidance. Tool will fail silently or throw unhandled exceptions on permission denied, invalid path, or full disk. No actionable error messages for LLM retry/recovery.
Tool name 'SaveFile' is generic and does not follow verb_noun pattern (should be 'write_file' or 'save_text_to_file'). LLMs rely on action verbs to infer intent; 'SaveFile' is ambiguous about whether it creates, appends, or overwrites.
Output schema is not documented. Callers cannot know what the tool returns on success (file path, size, confirmation?). Baseline requires documented return types for all tools.
fileContent parameter has no maximum length constraint. LLMs may attempt to write gigabyte-sized files, exhausting disk or causing timeouts. Numeric constraints (e.g., maxLength: 10MB) required.
No security pattern for sensitive file paths. Tool could be tricked into writing to system directories (/etc/passwd, C:/Windows/System32) or creating backdoors. Path validation and sandboxing required.