Skip to main content
Glama

copy_column_layout

Copy column layouts between DEVONthink smart groups or smart rules to maintain consistent display settings for document organization.

Instructions

Copy the column layout (column order, visible columns, and column widths) from one DEVONthink smart group or smart rule to another. All three layout keys are copied atomically. Supports partial name matching. Input: { "sourceName": "Archivieren - Jobs", "targetName": "Jobs - To Review" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceNameYesName of the source smart group or smart rule (must have a saved layout)
targetNameYesName of the target smart group or smart rule to copy the layout to
sourceUuidNoOptional UUID of the source smart group (fallback if name lookup fails). DEVONthink sometimes stores layouts under the UUID.
targetUuidNoOptional UUID of the target smart group. If supplied, the layout is written under the UUID key (which DEVONthink prefers for smart groups).

Implementation Reference

  • Handler for copy_column_layout, logic to read source layout and write it to target.
    const copyColumnLayout = async (args: Record<string, unknown>): Promise<CopyColumnLayoutResult> => {
      const sourceName = args.sourceName as string | undefined;
      const targetName = args.targetName as string | undefined;
      const sourceUuid = args.sourceUuid as string | undefined;
      const targetUuid = args.targetUuid as string | undefined;
    
      if (!sourceName || typeof sourceName !== "string") {
        return { success: false, error: "sourceName parameter is required" };
      }
      if (!targetName || typeof targetName !== "string") {
        return { success: false, error: "targetName parameter is required" };
      }
    
      let resolvedSourceKey: string | null = null;
    
      if (readLayoutForName(sourceName)) {
        resolvedSourceKey = sourceName;
      } else if (sourceUuid && readLayoutForName(sourceUuid)) {
        resolvedSourceKey = sourceUuid;
      } else {
        const fuzzy = findMatchingNames(sourceName);
        if (fuzzy.length === 1 && readLayoutForName(fuzzy[0])) {
          resolvedSourceKey = fuzzy[0];
        } else if (fuzzy.length > 1) {
          return {
            success: false,
            sourceName,
            targetName,
            error: `Ambiguous source name "${sourceName}". Multiple matches: ${fuzzy.slice(0, 8).join(", ")}`,
          };
        }
      }
    
      if (!resolvedSourceKey) {
        const examples = getExistingNames(10);
        return {
          success: false,
          sourceName,
          targetName,
          error:
            `Source column layout for "${sourceName}" not found. ` +
            "This smart group may not have a custom layout saved yet. " +
            `Known layouts include: ${examples.slice(0, 8).join(", ")}`,
        };
      }
    
      const resolvedTargetKey = targetUuid ?? targetName;
    
      const copyResult = copyPlistKeys(PLIST_PATH, LAYOUT_SUFFIXES, resolvedSourceKey, resolvedTargetKey);
    
      if (!copyResult.ok) {
        return {
          success: false,
          sourceName,
          targetName,
          resolvedSourceKey,
          resolvedTargetKey,
          error: `Copy failed: ${copyResult.error}`,
        };
      }
    
      const verification = readLayoutForName(resolvedTargetKey);
    
      if (!verification) {
        return {
          success: false,
          sourceName,
          targetName,
          resolvedSourceKey,
          resolvedTargetKey,
          error: "Copy appeared to succeed but target keys not readable after write",
        };
      }
    
      return {
        success: true,
        sourceName,
        targetName,
        resolvedSourceKey,
        resolvedTargetKey,
        keysCopied: copyResult.keysCopied,
        message:
          `Copied column layout from "${sourceName}" to "${targetName}". ` +
          `Keys written: ${copyResult.keysCopied.join(", ")}. ` +
          `Columns: [${verification.columns?.join(", ") ?? "n/a"}]. ` +
          "Restart DEVONthink or close/reopen the smart group window for the change to take effect.",
      };
    };
  • Registration of the copy_column_layout tool.
    export const copyColumnLayoutTool: McpTool = {
      name: "copy_column_layout",
      description:
        "Copy the column layout (column order, visible columns, and column widths) from one " +
        "DEVONthink smart group or smart rule to another. " +
        "All three layout keys are copied atomically. Supports partial name matching. " +
        'Input: { "sourceName": "Archivieren - Jobs", "targetName": "Jobs - To Review" }',
      inputSchema: {
        type: "object" as const,
        properties: {
          sourceName: {
            type: "string",
            description: "Name of the source smart group or smart rule (must have a saved layout)",
          },
          targetName: {
            type: "string",
            description: "Name of the target smart group or smart rule to copy the layout to",
          },
          sourceUuid: {
            type: "string",
            description:
              "Optional UUID of the source smart group (fallback if name lookup fails). " +
              "DEVONthink sometimes stores layouts under the UUID.",
          },
          targetUuid: {
            type: "string",
            description:
              "Optional UUID of the target smart group. If supplied, the layout is written " +
              "under the UUID key (which DEVONthink prefers for smart groups).",
          },
        },
        required: ["sourceName", "targetName"],
        additionalProperties: false,
      },
      run: copyColumnLayout,
    };
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It successfully notes that the three layout keys are copied 'atomically' and that partial name matching is supported, but fails to explicitly state that this operation modifies the target entity, lacks error handling details, and omits idempotency characteristics.

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 efficiently structured with the core action stated first, followed by behavioral details (atomicity, partial matching), and ending with a practical example. There is minimal redundancy, though the input example slightly overlaps with schema documentation.

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

Completeness3/5

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

Given the lack of annotations and output schema, the description adequately covers what is copied and how matching works, but should explicitly confirm the write/mutation nature of the operation and describe success/failure indicators or return behavior to be fully 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?

While the schema has 100% coverage, the description adds valuable semantic context beyond the schema by specifying that partial name matching is supported (affecting how sourceName/targetName are interpreted) and provides a concrete input example showing the expected parameter structure.

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 specific action (copy), the exact resource (column order, visible columns, column widths), and the entities involved (DEVONthink smart groups/smart rules). However, it does not explicitly distinguish itself from the sibling tool 'get_column_layout' or clarify that this is the write-oriented counterpart.

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 useful usage constraints including partial name matching support and includes a concrete JSON example showing required parameters. However, it lacks explicit guidance on when to use this versus 'get_column_layout' or prerequisites such as requiring the source to have a saved layout (only mentioned in the schema, not the description).

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/mnott/Devon'

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