Skip to main content

Tool Categories

The agent has access to two categories of tools:
  1. Native Anthropic Tools: Built-in capabilities (code_execution, web_search, memory, web_fetch)
  2. Custom Tools: Application-specific tools for Canvas, Todos, and Study

Native Anthropic Tools

code_execution

Run Python code in a sandboxed environment.
code
string
required
Python code to execute
Features:
  • Files persist across conversation (~4.5 minute timeout)
  • Access to standard Python libraries
  • Can call other tools programmatically via await toolName(params)
  • Supports asyncio for parallel operations
Configuration:
code_execution: anthropic.tools.codeExecution_20250825()
Search the web for current information.
query
string
required
Search query
Features:
  • Location-aware results using user’s city, region, country
  • Maximum 5 searches per conversation
  • Returns snippets with URLs
Configuration:
web_search: anthropic.tools.webSearch_20250305({
  userLocation: {
    type: "approximate",
    city: ctx.city,
    country: ctx.country,
    region: ctx.region,
    timezone: ctx.timezone,
  },
})

memory

Store and retrieve persistent user information with a filesystem-like interface.
command
enum
required
Operation to perform: view, create, str_replace, insert, delete, rename
path
string
required
File path (must start with /memories)
Configuration:
memory: anthropic.tools.memory_20250818({
  execute: async (action) => {
    return await executeMemoryCommand(ctx.userId, action);
  },
})
See Memory System for detailed documentation.

web_fetch

Fetch and process web content.
url
string
required
URL to fetch
Configuration:
web_fetch: anthropic.tools.webFetch_20250910()

Canvas LMS Tools

searchContent

Semantic search across Canvas course content.
query
string
required
Student’s question or search query
Returns:
[
  {
    content: {
      name: string,
      allowed_attempts: number,
      className: string,
      description?: string,
      due_at?: string,
      lock_at?: string
    },
    id: string,
    metadata: {
      classId: number,
      type: string
    },
    score: number // 0-1 relevance score
  }
]
Allowed Callers: Direct and code_execution Implementation:
// apps/web/src/ai/tools/canvas/search-content.ts
export const searchContentTool = tool({
  description: "Search for assignments, announcements, and other course information...",
  inputSchema: z.object({
    query: z.string().describe("Student's question"),
  }),
  execute: async ({ query }) => {
    return await queryCanvasIndex(query);
  },
  providerOptions: {
    anthropic: {
      allowedCallers: ["direct", "code_execution_20250825"],
      cacheControl: { type: "ephemeral" },
    },
  },
});

getClassAssignments

Programmatic only: Can only be called from within code_execution
Fetch assignments from Canvas LMS.
classId
string
Canvas class ID. If omitted, fetches from ALL classes in parallel
filter
enum
Optional filter: past, overdue, undated, ungraded, unsubmitted, upcoming, future
Returns:
[
  {
    id: number,
    name: string,
    description: string,
    due_at: string | null,
    points_possible: number,
    submission: { submitted_at: string | null },
    _classId: string,    // Added when fetching all classes
    _className: string   // Added when fetching all classes
  }
]
Usage Example:
import json

# Fetch from all classes
result = await getClassAssignments({})
assignments = json.loads(result)

# Fetch from specific class with filter
result = await getClassAssignments({
    "classId": "12345",
    "filter": "upcoming"
})
upcoming = json.loads(result)
Implementation:
// apps/web/src/ai/tools/canvas/get-class-assignments.ts
export const getClassAssignmentsTool = tool({
  description: "Fetch assignments from Canvas LMS...",
  inputSchema: z.object({
    classId: z.string().optional(),
    filter: z.enum([...]).optional(),
  }),
  execute: async ({ classId, filter }) => {
    // Fetch logic with parallel processing for all classes
  },
  providerOptions: {
    anthropic: {
      allowedCallers: ["code_execution_20250825"],
      cacheControl: { type: "ephemeral" },
    },
  },
});

Todo Management Tools

All Todo tools are programmatic only: Can only be called from code_execution

getTodos

Fetch user’s todos filtered by view.
view
enum
required
  • today: Scheduled for today or overdue
  • upcoming: Scheduled in the future
  • anytime: No specific date
  • someday: Later/maybe
  • active: All uncompleted
  • logbook: Completed items
limit
number
For logbook view only: limit number of results (default 50)
Returns: JSON string containing array of todo objects Usage Example:
import json

# Get today's todos
todos_json = await getTodos({"view": "today"})
todos = json.loads(todos_json)

for todo in todos:
    print(f"{todo['title']} - Due: {todo.get('dueDate')}")

createTodo

Create a new todo item.
title
string
required
Todo title/description
description
string
Optional detailed description
dateType
enum
When to work on it:
  • calendar: Specific date/time
  • calendarEvening: Evening of date
  • anytime: No specific time (default)
  • someday: Later/maybe
scheduledDate
string
ISO date string for when to work on it (for calendar/calendarEvening types)
dueDate
string
ISO date string for deadline
subTasks
array
Array of subtask objects: [{ id: string, title: string, checked: boolean }]
canvasContentType
enum
Type of Canvas content: assignment, page, quiz, discussion
canvasContentId
number
Canvas content ID (e.g., assignment ID)
canvasClassId
number
Canvas class/course ID
Usage Example:
# Create todo linked to Canvas assignment
await createTodo({
    "title": "Complete Math Homework",
    "description": "Chapter 5 exercises 1-20",
    "dateType": "calendar",
    "scheduledDate": "2026-03-08T14:00:00Z",
    "dueDate": "2026-03-10T23:59:00Z",
    "canvasContentType": "assignment",
    "canvasContentId": 12345,
    "canvasClassId": 67890
})

updateTodo

Update an existing todo item.
id
string
required
Todo ID to update
title
string
New title
description
string
New description
checked
boolean
Mark as complete/incomplete
dateType
enum
Change date type
scheduledDate
string
ISO date string for new scheduled date
dueDate
string
ISO date string for new due date
subTasks
array
Updated subtasks array
Usage Example:
# Mark todo as complete
await updateTodo({
    "id": "todo-uuid-here",
    "checked": True
})

# Reschedule todo
await updateTodo({
    "id": "todo-uuid-here",
    "scheduledDate": "2026-03-12T10:00:00Z"
})

deleteTodo

Delete a todo permanently.
id
string
required
Todo ID to delete
Usage Example:
await deleteTodo({"id": "todo-uuid-here"})

Study Tools

createStudySet

Create flashcards or practice questions for studying.
displayMode
enum
required
Display mode: flashcards, multiple-choice, short-answer
title
string
required
Study set title
items
array
required
Array of study items (see below)
Item Types:
{
  type: "term",
  tags: string[] | null,
  term: string,
  shortDefinition: string,
  fullDefinition: string
}
{
  type: "question",
  tags: string[] | null,
  prompt: string,
  thinking: string | null,
  explanation: string | null,
  options: Array<{ correct: boolean, text: string }>
}
Features:
  • Supports LaTeX for math formulas: $$x^2 + y^2 = z^2$$
  • Multiple display modes for different learning styles
  • Tag-based organization
Allowed Callers: Direct and code_execution Usage Example:
await createStudySet({
    "displayMode": "flashcards",
    "title": "Calculus I - Chapter 3",
    "items": [
        {
            "type": "term",
            "tags": ["derivatives"],
            "term": "Power Rule",
            "shortDefinition": "$$\\frac{d}{dx}[x^n] = nx^{n-1}$$",
            "fullDefinition": "The derivative of x to the power of n equals n times x to the power of n minus 1."
        },
        {
            "type": "term",
            "tags": ["derivatives", "trigonometry"],
            "term": "Derivative of sin(x)",
            "shortDefinition": "$$\\frac{d}{dx}[\\sin(x)] = \\cos(x)$$",
            "fullDefinition": "The derivative of sine x is cosine x."
        }
    ]
})
Implementation:
// apps/web/src/ai/tools/study/flashcards.ts
export const createStudySetTool = tool({
  description: "Create flashcards or practice questions for studying...",
  inputSchema: createStudySetToolInput,
  execute: async (data) => {
    return `Study set "${data.title}" created successfully with ${data.items.length} items...`;
  },
  providerOptions: {
    anthropic: {
      allowedCallers: ["direct", "code_execution_20250825"],
      cacheControl: { type: "ephemeral" },
    },
  },
});

Tool Configuration Reference

All tools are configured in apps/web/src/ai/agents/general.ts:
export function getGeneralAgentTools(ctx: AgentContext): Record<string, any> {
  return {
    // Native Anthropic tools
    code_execution: anthropic.tools.codeExecution_20250825(),
    memory: anthropic.tools.memory_20250818({ execute: ... }),
    web_search: anthropic.tools.webSearch_20250305({ userLocation: ... }),
    web_fetch: anthropic.tools.webFetch_20250910(),

    // Canvas LMS
    searchContent: searchContentTool,
    getClassAssignments: getClassAssignmentsTool,

    // Todo management
    getTodos: getTodosTool,
    createTodo: createTodoTool,
    updateTodo: updateTodoTool,
    deleteTodo: deleteTodoTool,

    // Study tools
    createStudySet: createStudySetTool,
  };
}

Provider Options

All custom tools include provider-specific configuration:
providerOptions: {
  anthropic: {
    allowedCallers: ["direct", "code_execution_20250825"],
    cacheControl: { type: "ephemeral" },
  },
}
  • allowedCallers: Restricts where tool can be invoked
    • "direct": Can be called directly by the model
    • "code_execution_20250825": Can be called from Python code
  • cacheControl: Uses ephemeral caching to reduce latency

Next Steps

General Agent

Learn about the system prompt and capabilities

Memory System

Deep dive into persistent user memory

Build docs developers (and LLMs) love