@@ -237,6 +237,31 @@ export function formatToolAnnotations(annotations: Tool['annotations']): string
237237 return parts . length > 0 ? parts . join ( ', ' ) : null ;
238238}
239239
240+ /**
241+ * Get the task support mode for a tool ('required', 'optional', or undefined)
242+ */
243+ export function getToolTaskSupport ( tool : Tool ) : string | undefined {
244+ const toolAny = tool as Record < string , unknown > ;
245+ const execution = toolAny . execution as Record < string , unknown > | undefined ;
246+ return execution ?. taskSupport as string | undefined ;
247+ }
248+
249+ /**
250+ * Format tool hints: annotations + task support mode.
251+ * Returns a string like "destructive, open-world, task:required" or null if empty.
252+ */
253+ export function formatToolHints ( tool : Tool ) : string | null {
254+ const parts : string [ ] = [ ] ;
255+
256+ const annotationsStr = formatToolAnnotations ( tool . annotations ) ;
257+ if ( annotationsStr ) parts . push ( annotationsStr ) ;
258+
259+ const taskSupport = getToolTaskSupport ( tool ) ;
260+ if ( taskSupport ) parts . push ( `task:${ taskSupport } ` ) ;
261+
262+ return parts . length > 0 ? parts . join ( ', ' ) : null ;
263+ }
264+
240265/**
241266 * Convert a JSON Schema type definition to a simplified type string
242267 * e.g., { type: 'string' } -> 'string'
@@ -466,15 +491,8 @@ export function formatToolParamsInline(schema: Record<string, unknown>): string
466491export function formatToolLine ( tool : Tool ) : string {
467492 const bullet = chalk . dim ( '*' ) ;
468493 const params = formatToolParamsInline ( tool . inputSchema as Record < string , unknown > ) ;
469- const parts : string [ ] = [ ] ;
470- const annotationsStr = formatToolAnnotations ( tool . annotations ) ;
471- if ( annotationsStr ) parts . push ( annotationsStr ) ;
472- // Show task execution mode
473- const toolAny = tool as Record < string , unknown > ;
474- const execution = toolAny . execution as Record < string , unknown > | undefined ;
475- const taskSupport = execution ?. taskSupport as string | undefined ;
476- if ( taskSupport ) parts . push ( `task:${ taskSupport } ` ) ;
477- const suffix = parts . length > 0 ? ` ${ chalk . gray ( `[${ parts . join ( ', ' ) } ]` ) } ` : '' ;
494+ const hintsStr = formatToolHints ( tool ) ;
495+ const suffix = hintsStr ? ` ${ chalk . gray ( `[${ hintsStr } ]` ) } ` : '' ;
478496 return `${ bullet } ${ grayBacktick ( ) } ${ chalk . cyan ( tool . name ) } ${ params } ${ grayBacktick ( ) } ${ suffix } ` ;
479497}
480498
@@ -536,10 +554,10 @@ export function formatToolDetail(tool: Tool): string {
536554 lines . push ( chalk . bold ( `# ${ title } ` ) ) ;
537555 }
538556
539- // Tool header: Tool: `name` [annotations ]
540- const annotationsStr = formatToolAnnotations ( tool . annotations ) ;
541- const annotationsSuffix = annotationsStr ? ` ${ chalk . gray ( `[${ annotationsStr } ]` ) } ` : '' ;
542- lines . push ( `${ chalk . bold ( 'Tool:' ) } ${ inBackticks ( tool . name ) } ${ annotationsSuffix } ` ) ;
557+ // Tool header: Tool: `name` [hints ]
558+ const hintsStr = formatToolHints ( tool ) ;
559+ const hintsSuffix = hintsStr ? ` ${ chalk . gray ( `[${ hintsStr } ]` ) } ` : '' ;
560+ lines . push ( `${ chalk . bold ( 'Tool:' ) } ${ inBackticks ( tool . name ) } ${ hintsSuffix } ` ) ;
543561
544562 // Input args
545563 lines . push ( '' ) ;
@@ -612,11 +630,19 @@ function exampleValue(propSchema: Record<string, unknown>): string {
612630export function formatToolCallExample ( tool : Tool , sessionName ?: string ) : string | null {
613631 const schema = tool . inputSchema as Record < string , unknown > | undefined ;
614632 const properties = schema ?. properties as Record < string , Record < string , unknown > > | undefined ;
633+ const session = sessionName || '<@session>' ;
634+
635+ // Build --task flag based on task support
636+ const taskSupport = getToolTaskSupport ( tool ) ;
637+ const taskFlag =
638+ taskSupport === 'required' ? ' --task' : taskSupport === 'optional' ? ' [--task]' : '' ;
639+
640+ const bullet = chalk . dim ( '*' ) ;
615641
616642 if ( ! properties || Object . keys ( properties ) . length === 0 ) {
617643 // Tool takes no arguments — still show the simple call
618- const session = sessionName || '<@ session>' ;
619- return `${ chalk . bold ( 'Call example:' ) } \n mcpc ${ session } tools-call ${ tool . name } ` ;
644+ const cmd = `mcpc ${ session } tools-call ${ tool . name } ${ taskFlag } ` ;
645+ return `${ chalk . bold ( 'Call example:' ) } \n${ bullet } ${ grayBacktick ( ) } ${ chalk . cyan ( cmd ) } ${ grayBacktick ( ) } ` ;
620646 }
621647
622648 const requiredNames = ( schema ?. required as string [ ] ) || [ ] ;
@@ -632,13 +658,13 @@ export function formatToolCallExample(tool: Tool, sessionName?: string): string
632658 params . push ( ...optionalInOrder . slice ( 0 , remaining ) ) ;
633659 }
634660
635- const session = sessionName || '<@session>' ;
636661 const argParts = params . map ( ( name ) => {
637662 const val = exampleValue ( properties [ name ] ?? { } ) ;
638663 return `${ name } :=${ val } ` ;
639664 } ) ;
640665
641- return `${ chalk . bold ( 'Call example:' ) } \n mcpc ${ session } tools-call ${ tool . name } ${ argParts . join ( ' ' ) } ` ;
666+ const cmd = `mcpc ${ session } tools-call ${ tool . name } ${ argParts . join ( ' ' ) } ${ taskFlag } ` ;
667+ return `${ chalk . bold ( 'Call example:' ) } \n${ bullet } ${ grayBacktick ( ) } ${ chalk . cyan ( cmd ) } ${ grayBacktick ( ) } ` ;
642668}
643669
644670/**
0 commit comments