Skip to main content
Glama
ppetru

TiddlyWiki MCP Server

by ppetru

create_tiddler

Create a new tiddler in TiddlyWiki with preview and approval. Input title, text, tags, type, and custom fields such as caption or summary.

Instructions

Create a new tiddler. Shows a preview and requests approval before creating. Supports arbitrary custom fields beyond the standard ones (e.g., caption, summary, author, or any TiddlyWiki field).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the new tiddler
textYesText content
tagsNoTags as space-separated string (optional, e.g., "Journal" or "Journal OYS")
typeNoContent type (default: text/markdown)text/markdown

Implementation Reference

  • Main handler function for create_tiddler tool. Parses input via Zod schema, checks for duplicate tiddlers, creates a new tiddler object (with custom fields merged), generates a preview, calls putTiddler to save it, and returns the preview result.
    export async function handleCreateTiddler(args: unknown): Promise<ToolResult> {
      const input = CreateTiddlerInput.parse(args);
    
      // Check if tiddler already exists
      const existing = await getTiddler(input.title);
      if (existing) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                { error: `Tiddler already exists: ${input.title}. Use update_tiddler to modify it.` },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    
      // Create new tiddler object with custom fields
      const { title, text, tags, type, ...customFields } = input;
      const newTiddler = {
        ...createTiddlerObject(title, text, tags || '', type || 'text/markdown', getAuthUser()),
        ...customFields, // Add any custom fields
      };
    
      // Generate preview
      const preview = formatTiddlerPreview(newTiddler);
    
      // Create the tiddler
      await putTiddler(newTiddler);
    
      return {
        content: [
          {
            type: 'text',
            text: `## Created: "${input.title}"\n\n${preview}`,
          },
        ],
      };
    }
  • Zod schema for CreateTiddlerInput validating title (string, required), text (string, required), tags (optional string), type (optional string, default text/markdown), and allowing passthrough for arbitrary custom fields.
    export const CreateTiddlerInput = z
      .object({
        title: z.string().describe('Title of the new tiddler'),
        text: z.string().describe('Text content'),
        tags: z.string().optional().describe('Tags (space-separated)'),
        type: z.string().optional().describe('Content type (default: text/markdown)'),
      })
      .passthrough(); // Allow additional custom fields
    
    export type CreateTiddlerInputType = z.infer<typeof CreateTiddlerInput>;
  • src/index.ts:185-218 (registration)
    Tool registration: declares the 'create_tiddler' tool with description and inputSchema for the MCP server, including title (required), text (required), tags (optional), type (optional), and additionalProperties for custom fields.
    {
      name: 'create_tiddler',
      description:
        'Create a new tiddler. Shows a preview and requests approval before creating. Supports arbitrary custom fields beyond the standard ones (e.g., caption, summary, author, or any TiddlyWiki field).',
      inputSchema: {
        type: 'object',
        properties: {
          title: {
            type: 'string',
            description: 'Title of the new tiddler',
          },
          text: {
            type: 'string',
            description: 'Text content',
          },
          tags: {
            type: 'string',
            description:
              'Tags as space-separated string (optional, e.g., "Journal" or "Journal OYS")',
            default: '',
          },
          type: {
            type: 'string',
            description: 'Content type (default: text/markdown)',
            default: 'text/markdown',
          },
        },
        additionalProperties: {
          type: 'string',
          description: 'Any additional TiddlyWiki field (e.g., caption, summary, author)',
        },
        required: ['title', 'text'],
      },
    },
  • src/index.ts:250-251 (registration)
    Dispatch switch-case in CallToolRequestSchema handler that routes 'create_tiddler' requests to the handleCreateTiddler function.
    case 'create_tiddler':
      return await handleCreateTiddler(args);
  • Helper function createTiddlerObject: constructs a Tiddler object with title, text, type, tags, created timestamp, and creator. Used by the handler to build the new tiddler payload.
    export function createTiddlerObject(
      title: string,
      text: string,
      tags: string = '',
      type: string = 'text/markdown',
      creator: string
    ): Tiddler {
      return {
        title,
        text,
        type,
        tags,
        created: generateTimestamp(),
        creator,
      };
    }
Behavior4/5

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

With no annotations provided, the description fully discloses the non-immediate nature of the action ('shows a preview and requests approval'). It also mentions support for custom fields, adding useful behavioral context. No contradictions.

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 two sentences, front-loads the primary purpose and key behavior, and contains no unnecessary information. Every sentence is essential.

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?

The description covers purpose, key behavior (preview/approval), and custom fields. Without an output schema, it does not mention return values, but for a creation tool this is acceptable. Slightly missing confirmation details, but overall complete given context.

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 100%, so parameters are well-documented in the schema. The description adds value by explicitly noting that arbitrary custom fields beyond the schema are supported, which is not evident from the schema alone.

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

Purpose5/5

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

The description clearly states the action ('create a new tiddler'), identifies the resource ('tiddler'), and distinguishes itself from sibling tools (delete, search, update) by specifying creation-specific behavior like preview and approval.

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

Usage Guidelines4/5

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

The description implies usage for creation by contrasting with siblings (no search/delete/update) and notes a key behavior (preview/approval). However, it does not explicitly state when not to use it or provide alternatives, but this is partially mitigated by sibling names.

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/ppetru/tiddlywiki-mcp'

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