Chapter 9

Tool Outputs & Permissions

Returns formatted search results from the web. Complete reference for tool output interfaces and permission types.

TodoWriteOutput

Returns confirmation with current task statistics.

PropertyTypeDescription
messagestringSuccess message
statsobjectCurrent todo statistics

Stats structure:

PropertyTypeDescription
totalnumberTotal number of tasks
pendingnumberNumber of pending tasks
in_progressnumberNumber of in-progress tasks
completednumberNumber of completed tasks

ExitPlanModeOutput

Returns confirmation after exiting plan mode.

PropertyTypeDescription
messagestringConfirmation message
approvedboolean?Whether user approved the plan

ListMcpResourcesOutput

Returns list of available MCP resources.

PropertyTypeDescription
resourcesResource[]Available resources
totalnumberTotal number of resources

Resource structure:

PropertyTypeDescription
uristringResource URI
namestringResource name
descriptionstring?Optional description
mimeTypestring?Optional MIME type
serverstringServer providing the resource

ReadMcpResourceOutput

Returns the contents of the requested MCP resource.

PropertyTypeDescription
contentsContent[]Resource contents
serverstringServer that provided the resource

Content structure:

PropertyTypeDescription
uristringContent URI
mimeTypestring?Optional MIME type
textstring?Text content
blobstring?Binary content (base64)

Permission Types

Types for managing tool permissions and access control.

PermissionUpdateUnion Type

Operations for updating permissions.

type PermissionUpdate =
  | {
      type: 'addRules';
      rules: PermissionRuleValue[];
      behavior: PermissionBehavior;
      destination: PermissionUpdateDestination;
    }
  | {
      type: 'replaceRules';
      rules: PermissionRuleValue[];
      behavior: PermissionBehavior;
      destination: PermissionUpdateDestination;
    }
  | {
      type: 'removeRules';
      rules: PermissionRuleValue[];
      behavior: PermissionBehavior;
      destination: PermissionUpdateDestination;
    }
  | {
      type: 'setMode';
      mode: PermissionMode;
      destination: PermissionUpdateDestination;
    }
  | {
      type: 'addDirectories';
      directories: string[];
      destination: PermissionUpdateDestination;
    }
  | {
      type: 'removeDirectories';
      directories: string[];
      destination: PermissionUpdateDestination;
    }

PermissionBehaviorType Alias

Defines the behavior for a permission rule.

type PermissionBehavior = 'allow' | 'deny' | 'ask';
ValueDescription
'allow'Automatically allow the action
'deny'Automatically deny the action
'ask'Prompt the user for permission

PermissionUpdateDestinationType Alias

Specifies where permission settings are stored.

type PermissionUpdateDestination =
  | 'userSettings'     // Global user settings
  | 'projectSettings'  // Per-directory project settings
  | 'localSettings'    // Gitignored local settings
  | 'session'          // Current session only
ValueDescription
'userSettings'Global user settings that apply across all projects
'projectSettings'Per-directory project settings (committed to repo)
'localSettings'Gitignored local settings for personal preferences
'session'Current session only (not persisted)

PermissionRuleValueInterface

Defines a permission rule for a specific tool.

type PermissionRuleValue = {
  toolName: string;
  ruleContent?: string;
}
PropertyTypeRequiredDescription
toolNamestringYesThe name of the tool this rule applies to
ruleContentstringNoOptional rule content or pattern for matching