MCPcopy Index your code
hub / github.com/github/docs / ToolPicker

Function ToolPicker

components/article/ToolPicker.tsx:47–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46const toolQueryKey = 'tool'
47export const ToolPicker = () => {
48 // allTools comes from the ArticleContext which contains the list of tools available
49 const { defaultTool, detectedTools, allTools } = useArticleContext()
50
51 if (!detectedTools.length) return null
52
53 const options = detectedTools.map((value) => {
54 return { value, label: allTools[value] }
55 })
56
57 return (
58 <InArticlePicker
59 fallbackValue={getDefaultTool(defaultTool, detectedTools)}
60 cookieKey="toolPreferred"
61 queryStringKey={toolQueryKey}
62 onValue={(value: string) => {
63 preserveAnchorNodePosition(document, () => {
64 showToolSpecificContent(value, Object.keys(allTools))
65 })
66 }}
67 preferenceName="application"
68 ariaLabel="Tool"
69 options={options}
70 />
71 )
72}

Callers

nothing calls this directly

Calls 3

useArticleContextFunction · 0.90
getDefaultToolFunction · 0.85
showToolSpecificContentFunction · 0.85

Tested by

no test coverage detected