MCPcopy Create free account
hub / github.com/cloudflare/agents / getTools

Method getTools

examples/agents-as-tools/src/server.ts:857–974  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

855 }
856
857 override getTools(): ToolSet {
858 return {
859 research: tool({
860 description:
861 "Dispatch a Researcher helper to investigate a topic in depth. " +
862 "The helper does multi-step search and synthesis; you summarize " +
863 "the result for the user. Returns the helper's synthesized summary.",
864 inputSchema: z.object({
865 query: z
866 .string()
867 .min(3)
868 .describe(
869 "The research topic. Be specific — e.g. 'How does HTTP/3 differ from HTTP/2?' rather than 'HTTP'."
870 )
871 }),
872 execute: async ({ query }, { toolCallId, abortSignal }) => {
873 return await this._runHelperTurn(Researcher, query, toolCallId, 0, {
874 abortSignal
875 });
876 }
877 }),
878 plan: tool({
879 description:
880 "Dispatch a Planner helper to produce a concrete implementation " +
881 "plan for a feature or refactor. The helper inspects (simulated) " +
882 "files and writes a structured plan with overview / affected files / " +
883 "step-by-step / open questions sections. Use for 'how do I implement X' " +
884 "or 'what's a plan for Y' kinds of questions.",
885 inputSchema: z.object({
886 description: z
887 .string()
888 .min(5)
889 .describe(
890 "What needs planning. Be concrete — e.g. 'add a dark mode toggle to the settings page' rather than 'plan dark mode'."
891 )
892 }),
893 execute: async ({ description }, { toolCallId, abortSignal }) => {
894 return await this._runHelperTurn(
895 Planner,
896 description,
897 toolCallId,
898 0,
899 {
900 abortSignal
901 }
902 );
903 }
904 }),
905 compare: tool({
906 description:
907 "Dispatch TWO Researcher helpers in parallel to investigate two " +
908 "related topics simultaneously. Use for compare/contrast queries; " +
909 "the user sees both helpers' timelines unfolding side-by-side " +
910 "under the same tool call. Returns both summaries (or per-branch " +
911 "errors if one of the helpers failed).",
912 inputSchema: z.object({
913 a: z.string().min(3).describe("First topic to investigate."),
914 b: z

Callers

nothing calls this directly

Calls 3

_runHelperTurnMethod · 0.95
branchFunction · 0.85
describeMethod · 0.80

Tested by

no test coverage detected