Skip to main content
Glama
p-united
by p-united

create_sample_file

Generate a sample text file for testing purposes with a customizable filename, using the Simple MCP Server's file creation capability.

Instructions

サンプルファイルを作成します(テスト用)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNo作成するファイル名(デフォルト: sample.txt)

Implementation Reference

  • The main handler function for the 'create_sample_file' tool. It creates a sample text file in the current working directory (after path validation) with predefined content including timestamps, system info, and notes.
      private async createSampleFile(filename?: string): Promise<CallToolResult> {
        const sampleFilename = filename || "sample.txt";
        
        try {
          // 現在のワーキングディレクトリにサンプルファイルを作成
          const fullPath = path.resolve(process.cwd(), sampleFilename);
          const pathValidation = this.pathValidator.validatePath(fullPath);
          if (!pathValidation.isValid) {
            throw new Error(pathValidation.error);
          }
    
          console.error(`Creating sample file: ${pathValidation.normalizedPath}`);
    
          const sampleContent = `# サンプルファイル
    
    作成日時: ${new Date().toLocaleString("ja-JP")}
    
    これは MCP サーバによって作成されたサンプルファイルです。
    
    ## 内容
    - MCP (Model Context Protocol) のテスト
    - ClaudeDesktop との連携確認
    - ファイル操作の動作確認
    - セキュリティ制限付きパスアクセス
    
    ## システム情報
    - Node.js バージョン: ${process.version}
    - プラットフォーム: ${os.platform()}
    - アーキテクチャ: ${os.arch()}
    
    ## セキュリティ設定
    - パスアクセス制限: 有効
    - 許可されたディレクトリのみアクセス可能
    
    Happy coding! 🚀
    `;
    
          await fs.writeFile(pathValidation.normalizedPath, sampleContent, "utf-8");
          return {
            content: [
              {
                type: "text",
                text: `サンプルファイル "${pathValidation.normalizedPath}" を作成しました!\n\n内容:\n${sampleContent}`,
              },
            ],
            isError: false,
          };
        } catch (error) {
          throw new Error(`サンプルファイルの作成に失敗: ${error}`);
        }
  • src/index.ts:169-181 (registration)
    Tool registration in the TOOLS array, including name, description, and input schema. This is returned by the ListTools handler.
    {
      name: "create_sample_file",
      description: "サンプルファイルを作成します(テスト用)",
      inputSchema: {
        type: "object",
        properties: {
          filename: {
            type: "string",
            description: "作成するファイル名(デフォルト: sample.txt)",
          },
        },
      },
    },
  • Input schema definition for the 'create_sample_file' tool, specifying an optional 'filename' parameter.
    inputSchema: {
      type: "object",
      properties: {
        filename: {
          type: "string",
          description: "作成するファイル名(デフォルト: sample.txt)",
        },
      },
    },
  • Dispatch case in the main CallToolRequestSchema handler that routes to the createSampleFile method.
    case "create_sample_file":
      return await this.createSampleFile(args.filename as string);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While '作成します' (creates) implies a write/mutation operation, the description doesn't disclose where files are created (path/directory), what permissions are needed, whether files persist, what happens if filename conflicts exist, or any rate limits. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness5/5

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

The description is extremely concise - a single Japanese sentence that directly states the purpose and context. Every word earns its place with no wasted text, and the testing context is efficiently included parenthetically. The structure is front-loaded with the core action immediately stated.

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?

For a file creation tool with no annotations and no output schema, the description is insufficient. It doesn't explain where files are created, what format/content they contain, whether they're temporary or persistent, what permissions are required, or what the tool returns. The testing context hint is helpful but doesn't compensate for the missing behavioral and output information needed for proper tool invocation.

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 the schema already fully documents the single 'filename' parameter with its type, description, and default value. The description adds no additional parameter information beyond what's in the schema. Baseline 3 is appropriate when the schema does all the parameter documentation work.

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 verb ('作成します' - creates) and resource ('サンプルファイル' - sample file), specifying it's for testing purposes. It distinguishes from siblings like 'write_file' by indicating this creates a test file rather than a general file write operation. However, it doesn't explicitly differentiate from other potential file creation tools beyond the testing context.

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?

The description implies usage context with '(テスト用)' - for testing purposes, suggesting this tool should be used for testing scenarios rather than production file creation. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'write_file' or mention any prerequisites or exclusions for usage.

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

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/p-united/mcpSample'

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