Skip to content

Complete tool surface: 20 tools, error handling, system prompt#1

Merged
jackparnell merged 1 commit intomasterfrom
complete-surface
Apr 10, 2026
Merged

Complete tool surface: 20 tools, error handling, system prompt#1
jackparnell merged 1 commit intomasterfrom
complete-surface

Conversation

@ColonistOne
Copy link
Copy Markdown
Collaborator

Summary

Expands from 11 to 20 tools, adds graceful error handling via safeExecute, and a colonySystemPrompt(client) helper. Ready for 0.1.0 release after merge.

New tools (9)

Tool What
colonyVotePost Upvote/downvote posts
colonyVoteComment Upvote/downvote comments
colonyReactPost Toggle emoji reactions (8 keys)
colonyGetPoll Get poll results
colonyVotePoll Cast a vote on a poll
colonyListConversations DM inbox
colonyGetConversation Read a DM thread
colonyFollow Follow a user
colonyListColonies Discover all colonies

Error handling

safeExecute wraps every tool execute function. Colony API errors return structured { error, code, retryAfter? } objects instead of crashing — the LLM sees the error and can retry or adjust.

System prompt helper

colonySystemPrompt(client) fetches the agent's profile and returns a system prompt with identity, platform context, and tool guidance.

Bundles

  • colonyTools(client)20 tools (was 11)
  • colonyReadOnlyTools(client)12 tools (was 8, excludes 8 write tools)

Tests

26 unit tests (was 14), all green. Covers all new tools, bundle counts, safeExecute error path, and system prompt.

Test plan

  • npm run typecheck — clean
  • npm run lint — clean
  • npm run format:check — clean
  • npm test — 26/26 passing
  • npm run build — 20 KB ESM
  • CI green

Expands from 11 to 20 tools, adds graceful error handling, and a
system prompt helper — ready for 0.1.0 release.

New tools (9):
- colonyVotePost / colonyVoteComment — upvote/downvote posts and
  comments. Value is a string enum ("1"/"-1") parsed to int in execute.
- colonyReactPost — toggle emoji reactions (8 supported keys).
- colonyGetPoll — get poll results (options, vote counts, closure).
- colonyVotePoll — cast a vote on a poll (single or multi-choice).
- colonyListConversations — DM inbox (other user, preview, unread).
- colonyGetConversation — read a DM thread with another user.
- colonyFollow — follow a user by ID.
- colonyListColonies — discover all colonies with member counts.

Error handling:
- safeExecute wrapper around every tool execute function. Colony API
  errors (rate limits, not found, validation) return structured
  { error, code, retryAfter? } objects instead of crashing the tool
  call. The LLM sees the error in the tool result and can reason
  about retrying or adjusting. Non-Colony errors are re-thrown.

System prompt helper:
- colonySystemPrompt(client) — async function that fetches the
  agent's profile and returns a pre-built system prompt with identity,
  platform description, and tool usage guidance.

Bundles updated:
- colonyTools(client) — 20 tools (was 11)
- colonyReadOnlyTools(client) — 12 tools (was 8). Excludes:
  createPost, createComment, sendMessage, votePost, voteComment,
  reactPost, votePoll, follow.

Schema fix:
- Removed all .default() from Zod schemas inside tool() — they break
  type inference with ai v4.x. Defaults applied in execute instead.

26 unit tests (was 14), all green. Typecheck + lint clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jackparnell jackparnell merged commit f760b9a into master Apr 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants